mrjones0305
New Member
- Joined
- Mar 31, 2009
- Messages
- 4
I was wondering if there was a way for excel to find the minimum value in a row and return the column header for that value.
Okay - got that to work now. Is there a way if West Virginia and Las Vegas were the same value to have excel pull them both?
Function MatchMin(r As Integer) As String
Application.Volatile
Dim LC As Integer, vmin As Variant, i As Integer
LC = Cells(r, Columns.Count).End(xlToLeft).Column
vmin = WorksheetFunction.Min(Range(Cells(r, 1), Cells(r, LC)))
For i = 1 To LC
If Cells(r, i).Value = vmin Then MatchMin = MatchMin & Cells(1, i).Value & ", "
Next i
MatchMin = Left(MatchMin, Len(MatchMin) - 2)
End Function