Share via

Select maximum value and associated column name

Anonymous
2014-03-16T19:09:32+00:00

Hello,

I would like to reformat/ query a table like the one below to select not only the maximum value from each row, but also the column name it is associated with.  I'm not very familiar with SQL or macros or scripting.  Any advice for something relatively easy?  I'd pretty much like the resulting table to look like the one below if possible.

Thanks,

Aly

RecordID (Column A) Class1 (Column B) Class2 (Column C) max value per row ?CLASS (column name??)
1 50 100 [=max(B2:C2)] = 100 = Class2
2 200 50 [=max(B3:C3)] = 200 = Class1
Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2014-03-16T19:22:54+00:00

Hi,

Put this in E2 and drag down.

=INDEX($B$1:$C$1,MATCH(MAX(B2:C2),B2:C2,0))

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2014-03-16T19:37:03+00:00

    Awesome.  Worked perfectly.

    Thanks!

    Was this answer helpful?

    0 comments No comments