# Solved: Finding the minimum in an excel array

Discussion in 'Business Applications' started by JoeHart, Dec 28, 2010.

Not open for further replies.

Joined:
Aug 17, 2008
Messages:
125
Code:
```   Function MinAddress(The_Range)

' Sets variable equal to minimum value in the input range.
MinNum = Application.Min(The_Range)
' Loop to check each cell in the input range to see if equals the
' min variable.
For Each cell In The_Range
If cell = MinNum Then
' If the cell value equals the max variable it
' returns the address to the function and exits the loop
Exit For
End If
Next cell

End Function
```

File size:
15.5 KB
Views:
51
2. ### OBP

Joined:
Mar 8, 2005
Messages:
19,895
Joe, why not just sort the data using column B ascending, which will always put the minimum value in B25?

Joined:
Aug 17, 2008
Messages:
125

4. ### OBP

Joined:
Mar 8, 2005
Messages:
19,895
Are you sorting all the data based on column B?
You can't just sort column b, it has to be all the data selected. You can have a hidden column with the original sort sequence if you want to put it back as it was after.

Joined:
Aug 17, 2008
Messages:
125
Yes, if you look at the spreadsheet I attached their are blank in the B column with line up with the limiting element or L. These items don't sort correctly. This seems to be a lot harder than I originally thought. Sorting it does what I need but I have to do a little extra work after it is done. I guess I can write a formula in the next column so that the Limiting Element stays in line with the other two variables. So G28 would equal F27, I guess that would work.

Joe

As Seen On