Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Minimum value ignoring zero
How can I found the minimum value in a list ignoring the zeros?
for the moment I only know MinValue = Application.WorksheetFunction.Min(Range("A:A")) thanks in advance -- caroline |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Minimum value ignoring zero
Hi Caroline,
Try Activesheet.evaluate("=MIN(IF(ABS(G1:G20)<0,G1:G2 0))") it cannot be whole columns -- HTH RP (remove nothere from the email address if mailing direct) "caroline" wrote in message ... How can I found the minimum value in a list ignoring the zeros? for the moment I only know MinValue = Application.WorksheetFunction.Min(Range("A:A")) thanks in advance -- caroline |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Minimum value ignoring zero
In a worksheet cell, I'd use an array formula like:
=MIN(IF(A1:A65535<0,A1:A65535)) (hit ctrl-shift-enter instead of just enter) But notice that this array formula can't use the whole column. In code, I'd use something like: Option Explicit Sub testme() Dim minVal As Variant Dim myRng As Range With Worksheets("sheet1") Set myRng = Range("a1", .Cells(.Rows.Count, "A").End(xlUp)) End With minVal = Application.Evaluate("min(if(" _ & myRng.Address(external:=True) & "<0," _ & myRng.Address(external:=True) & "))") MsgBox minVal End Sub caroline wrote: How can I found the minimum value in a list ignoring the zeros? for the moment I only know MinValue = Application.WorksheetFunction.Min(Range("A:A")) thanks in advance -- caroline -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Minimum value ignoring zero
thanks to both of you.
-- caroline "Dave Peterson" wrote: In a worksheet cell, I'd use an array formula like: =MIN(IF(A1:A65535<0,A1:A65535)) (hit ctrl-shift-enter instead of just enter) But notice that this array formula can't use the whole column. In code, I'd use something like: Option Explicit Sub testme() Dim minVal As Variant Dim myRng As Range With Worksheets("sheet1") Set myRng = Range("a1", .Cells(.Rows.Count, "A").End(xlUp)) End With minVal = Application.Evaluate("min(if(" _ & myRng.Address(external:=True) & "<0," _ & myRng.Address(external:=True) & "))") MsgBox minVal End Sub caroline wrote: How can I found the minimum value in a list ignoring the zeros? for the moment I only know MinValue = Application.WorksheetFunction.Min(Range("A:A")) thanks in advance -- caroline -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I find the minimum value in a range while ignoring zeros? | Excel Worksheet Functions | |||
How to get the minimum number of one column while ignoring the err | Excel Discussion (Misc queries) | |||
How to lookup the minimum, 2nd minimum and 3rd minimum......... | Excel Worksheet Functions | |||
Ignoring #n/a | Excel Discussion (Misc queries) | |||
calculating the minimum value ignoring o | Excel Worksheet Functions |