MAX & MIN - Can Column Header be returned with these?

  • Thread starter Thread starter Diana
  • Start date Start date
D

Diana

Hello,

I'm doing MAX & MIN formulas on financial data. Instead of having the
actual MAX or MIN dollar amount show, I want the column header name to appear
instead. I haven't been able to figure it out. Is what I'm asking for
something that can be done?

Thanks for any guidance!
 
This UDF is for Max:

Public Function header(r As Range) As String
Dim rr As Range
Dim v As Variant
v = Application.WorksheetFunction.Max(r)
For Each rr In r
If rr.Value = v Then
Exit For
End If
Next
header = Cells(1, rr.Column).Value
End Function

Min is similar
 
Is what I'm asking for something that can be done?

Yes, but you have to provide some details.
 
Here is an example of what I need:

East West North South Max
Min
Joe $10 $23 $25 $21 North
East
Joy $35 $18 $11 $17 East
North

When I do my Max & Min formulas, I want the actual header to show, not the
$$$.

There has to be a way to do it because I do a reverse when using Match &
Index formulas..

Thanks so much!!!
 
Try this:

Column headers East - South in the range B1:E1

For the MAX:

=INDEX(B$1:E$1,MATCH(MAX(B2:E2),B2:E2,0))

For the MIN:

=INDEX(B$1:E$1,MATCH(MIN(B2:E2),B2:E2,0))

Copy both down as needed.
 
Great! Thanks so much....

T. Valko said:
Try this:

Column headers East - South in the range B1:E1

For the MAX:

=INDEX(B$1:E$1,MATCH(MAX(B2:E2),B2:E2,0))

For the MIN:

=INDEX(B$1:E$1,MATCH(MIN(B2:E2),B2:E2,0))

Copy both down as needed.
 
Back
Top