Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Finding lowest number depending on value from corresponding cell

Dim rng As Range

Set rng = Range(Range("F4"), Range("F4").End(xlDown))

MsgBox "The Lowest number is " & ActiveSheet.Evaluate("MIN(IF(" &
rng.Address & _
"=""F""," & rng.Offset(0, 1).Address & "))")


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Cathain" wrote in message
...
I have two columns side by side. One has a list of numbers and the other
has
either "M" or "F". So what I'm trying to do is find out the lowest value
for
all the F's. Also the code has to take into account if extra rows are
added.
Now I can find the lowest value in the column with numbers fine its just
everything I tried to take into account the column with the F's and M's
isnt
working. My code I have so far is what I have for finding the lowest
value:

Private Sub cmdLowest_Click()

Dim rng As Range, i As Integer, Lowest As Variant


Range("F4").Select
Range(Selection, Selection.End(xlDown)).Select
Set rng = Selection

Lowest = rng.Cells(1).Value
For i = 2 To rng.Count

If rng.Cells(i).Value < Lowest Then
Lowest = rng.Cells(i).Value
End If

Next i


MsgBox "The Lowest number is " & Lowest

End Sub



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
determine lowest number in several columns and replace lowest numb jerry Excel Worksheet Functions 1 June 18th 08 03:19 AM
Scores of a Range Cells. Highest or lowest depending a parameter cradino Excel Worksheet Functions 1 March 11th 07 08:09 AM
How can I show in a given cell a lowest number in a column? Charles Drummer Excel Discussion (Misc queries) 2 March 25th 06 07:14 AM
Change cell color if it is the lowest number of a group? Anthony Excel Discussion (Misc queries) 3 October 20th 05 02:05 AM
Copy a number from one cell to another depending on first number marcia driscoll Excel Worksheet Functions 3 May 3rd 05 08:30 PM


All times are GMT +1. The time now is 07:20 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"