Hi all,
I have a range of cells that contain negative and positive values plus 0.
I am trying to return for each row the minimum value in the range including only those > 0 and excluding the current row.
I have managed a solution by returning the minimum value before the current row and that after the current row. But its horrible
lastRow (aka G1): 11 =MAX((A:A<>"")*(ROW(A:A)))
Col A = values
Col B = lowest non-zero value before this row
Col C = lowest non-zero value after this row
Col D = lowest non-zero value of col C and Col D
arrVals: =Sheet1!$A$1:INDEX(Sheet1!$A$1:$A$50,lastRow)
Cell B1: =LET(minbefore,INDEX(arrVals,1):INDEX(arrVals,ROW()-1),IF(ROW()=1,0,MINIFS(minbefore,minbefore,">0")))
Cell C1: =LET(minafter,INDEX(arrVals,ROW()+1):INDEX(arrVals,lastRow),IF(ROW()=lastRow,0,MINIFS(minafter,minafter,">0")))
Cell D1: =MINIFS(B1:C1,B1:C1,">0")
Any help appreciated!
Note:
The cells cannot be converted to a table.
There will be 1 to 50 values.
A value may be duplicated (including the minimum value).
It must use a formula and not VBA.
I have a range of cells that contain negative and positive values plus 0.
I am trying to return for each row the minimum value in the range including only those > 0 and excluding the current row.
I have managed a solution by returning the minimum value before the current row and that after the current row. But its horrible
lastRow (aka G1): 11 =MAX((A:A<>"")*(ROW(A:A)))
Col A = values
Col B = lowest non-zero value before this row
Col C = lowest non-zero value after this row
Col D = lowest non-zero value of col C and Col D
arrVals: =Sheet1!$A$1:INDEX(Sheet1!$A$1:$A$50,lastRow)
Cell B1: =LET(minbefore,INDEX(arrVals,1):INDEX(arrVals,ROW()-1),IF(ROW()=1,0,MINIFS(minbefore,minbefore,">0")))
Cell C1: =LET(minafter,INDEX(arrVals,ROW()+1):INDEX(arrVals,lastRow),IF(ROW()=lastRow,0,MINIFS(minafter,minafter,">0")))
Cell D1: =MINIFS(B1:C1,B1:C1,">0")
Any help appreciated!
Note:
The cells cannot be converted to a table.
There will be 1 to 50 values.
A value may be duplicated (including the minimum value).
It must use a formula and not VBA.