Lowest value in range of cells excluding this row

RobOrBob

New Member
Joined
Aug 4, 2023
Messages
43
Office Version
  1. 365
Platform
  1. Windows
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 :)

Screenshot 2024-03-22 210315.png


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.
 
Here's a bit shorter one that I think also does what you want.

BTW, given that post #2 didn't actually do what you wanted, you might consider re-marking the solution post to one of the several others that seem to do so. :)

24 03 23.xlsm
AB
11.550.82
20.880.82
32.550.82
400.82
500.82
6-1.80.82
7-1.550.82
80.820.82
91.550.82
100.820.82
110.830.82
Sheet6
Cell Formulas
RangeFormula
B1:B11B1=LET(r,A$1:A$11,MIN(IF((r>0)*(ROW(r)<>ROW()),r)))
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,223,872
Messages
6,175,102
Members
452,613
Latest member
amorehouse

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top