2

I want to take element-wise maximum of two columns, that is pick whichever is larger in every row. So, with the input

+-------+
| A  B  |
+-------+
| 3  8  |
| 5  2  |
| 2  7  |
+-------+

the output should be a column with 8, 5, 7.

The function MAX can do this for two values like max(A2, B2) but when I try array formula

=arrayformula(max(A2:A4, B2:B4))

the output is just 8, the overall maximum.

1

Since it's just two columns,

=ARRAYFORMULA(IF(A2:A4>B2:B4,A2:A4,B2:B4))
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy