Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 183
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 183
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I find the minimum value in a range while ignoring zeros? Ted B. Excel Worksheet Functions 4 April 6th 10 04:22 AM
How to get the minimum number of one column while ignoring the err Yuanhang Excel Discussion (Misc queries) 2 June 30th 07 03:06 PM
How to lookup the minimum, 2nd minimum and 3rd minimum......... Mark McDonough Excel Worksheet Functions 8 July 15th 06 09:39 PM
Ignoring #n/a The Toasterman Excel Discussion (Misc queries) 6 June 28th 06 07:35 PM
calculating the minimum value ignoring o jo jo Excel Worksheet Functions 1 June 29th 05 11:36 PM


All times are GMT +1. The time now is 07:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"