Find Min Value in Range Excluding 0 and Hidden Cells

mike2246

New Member
Joined
Jan 13, 2015
Messages
26
Cell A100 Find Min of A2-A99 excluding 0's and Hidden rows. I found a website that shows how to do this for average by making a VB Module and it works perfect, just not sure how to change this to a Min Value.

Website Reference for Avg VB Code

Or this could also work in my situation if it could be done through conditional formatting, doing a gradient scale of lowest value that ignore's 0's and hidden cells.
 
Last edited:
Got an error when applying newest update. and i'm not sure if it's manual or filter. but I have VBA Code setup so that if a cell = No to hide rows for that player and Yes to be visable for all sheets
 

Attachments

  • error.PNG
    error.PNG
    48.2 KB · Views: 5
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Perfect, Thanks!!! if it's not to much so I can learn more what do all the #'s mean? 15,6,1? etc?

and is there an easy way to switch this to Max value instead of Min?
 
Last edited:
Upvote 0
is there an easy way to switch this to Max value instead of Min?
Just change 15 to 14, don't think it can get much easier than that.

For average, I think that it should work with this formula, array confirmed with Ctrl Shift Enter

=AVERAGE(IFERROR(1/(1/SUBTOTAL(109,OFFSET(A2,ROW(A2:A99)-ROW(A2),0,1,1))),""))

15 (SMALL), 6 (Ignore errors) and 104 (MAX) are function arguments, they are all listed in the tooltips which will show up if you edit the formula and delete the current number.
The last one, 104 would work with any one of several options used. 101,104,105,106 or 109 should all work for this formula.

1/(1/ is an error trap to eliminate zero values.

0,1,1))) sets an offset position from A2, the ROW() part creates an offset to each individual row from A2:A99, 0,1,1 sets no column offset, i.e. use the same column, 1 row tall, 1 column wide.
The final 1 at the end of the formula combined with the 15 at the start tells the aggregate function that you want the smallest value from the valid results, changing it to 2 would give the second smallest number (in the event of a tie with the smallest number, the same result would still be shown).
 
Upvote 0
This was the problem that we had with the first formula that I posted, aggregate appears to work with hidden rows or arrays (an array was used to ignore 0) but it doesn't work with both in the same formula.
Average didn't work I get #Value!
If you got that then it means that the array is not confirmed correctly.

Copy the formula from my earlier reply and past it into the cell, hold down Ctrl and Shift, then press Enter.
 
Upvote 0

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

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