I would like to calculate the maximum value of the minimum values of each row in a spreadsheet (Google Sheets, specifically) that is greater than 0. I hope that makes sense. My data is:
0 6 7 8 1
0 12 21 22 21
0 10 18 24
0 7 9 1 17
0 16 16 20
So, I want an ArrayFormula of some sort that will generate:
1
12
10
1
16
Of which I could then get the maximum. I've read and experienced that the obvious solution doesn't work, which is:
=max(ArrayFormula(min(if(A:Z>0,A:Z,"")))
The reason being the ArrayFormula(min(...
part of it returns the minimum of the whole data set that's greater than 0, which is 1 here. If there's no nice workaround, I'll consider rearranging my data somehow, or calculating minima in separate cells, but I'm really hoping for a 1-step solution.
max ArrayFunction doesn't exist, so the only way is workaround. Suppose, you have some numbers in range
A1:C5
. the resulting range isD1:D5
:All you need is single formula in cell
D1
:Be careful, it can work slow.
The main part of formula is query:
change it to get different results (max, min, sum, avg, some calculatrions and so on)
If someone want to explore the formula, here's worksheet with step-by step solution.
In addition to get the minimum value per row (allowing an array output in one go), try:
With data in the range A1:E5, in F1 and copied down:
or
should return the minimum value greater than 0 per row, for which the maximum might be calculated with: