find Max value in row--return value in same column, different row

G

Guest

I'm not sure how to accomplish this and thought someone may be able to give
me some ideas. Here's an example of how my data is laid out.

Row 1 Chevy Ford Dodge
Row 2 4 5 3
Row 3 5 3 4

I would like to enter a formula that would look for the maximum value in
each row and return the corresponding value in the same column, from row 1.
In the example the formula looking in row 2, would return "Ford". In row 3
the result would be "Chevy". I've been mulling over this but can't figure
out how to make this work. Any help would be appreciated.
 
A

Aladin Akyurek

Let A1:C4 house the following sample:

{"Chevy","Ford","Dodge";
2,4,5;
3,5,3;
7,7,4}

where A1 = Chevy, A2 = 2, etc.

Formulas...

D2, copied to F2 then down:

=IF(N(A2),RANK(A2,$A2:$C2)+COUNTIF($A2:A2,A2)-1,"")

G2:

=MAX(IF(INDEX(A2:C2,MATCH($H2,D2:F2,0))=A2:C2,D2:F2))-$H2

which must be confirmed with control+shift+enter instead of just with
enter.

This formula computes the number of ties of the max value.

H2 to H4 must house a 1, which denotes Top 1 highest.

I2, copied across to K2 then down:

=IF(COLUMN()-COLUMN($I2)+1<=$G2+$H2,INDEX($A$1:$C$1,MATCH(COLUMN()-COLUMN($I2)+1,$D2:$F2,0)),"")


I2:K4 will now house the results that you need.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top