PDA

View Full Version : Minimum Value Excluding Zero In Excel Range



S M C
11-30-2011, 03:00 PM
Here's a way to find the minimum value in a range of cells, after excluding zero



Dim rng as range
Set rng = Range("SomeRangeWhichAlsoHasZeroesInIt")
dbl = Evaluate("MIN(IF(" & rng.Address & "=0,""""," & rng.Address & "))")

Admin
11-30-2011, 03:30 PM
It could also be written as


dbl = Evaluate("MIN(IF(" & rng.Address & "<>0," & rng.Address & "))")

Rasm
12-01-2011, 07:11 AM
Would that not exclude all negative numbers as well as zero?

can you use

<>0

Admin
12-01-2011, 07:55 AM
Would that not exclude all negative numbers as well as zero?

can you use

<>0

Thanks Rasm. I edited the formula.