Macro to find copy "header" and paste

G

Guest

Hi Folks,
This may sound easy but it has stumped me.
I have a list of max values at the end of a row of 48 columns. I want to
find that max value within the row and then copy and paste the header (first
row) for the column the max value appears within. I cannot use a LOOKUP
function as the data is not sorted and has too many fields to use an if
statement.

Cheers,
RunsWithKnives
 
B

Biff

Hi!

Row 1 are column headers, A1:AV1

A2:AV2 = values

AW2 = =MAX(A2:AV2)

Find the corresponding header:

=INDEX(A$1:AV$1,MATCH(AW2,A2:AV2,0))

If there are duplicate max values the hearder for the first match (left to
right) will be returned.

Biff
 
G

Guest

Hey Cheers Biff,
that does the trick and I don't have to punt about with macros.

Thanks a bunch,

RunsWithKnives
 
B

Biff

You're welcome. Thanks for the feedback!

Biff

RunsWithKnives said:
Hey Cheers Biff,
that does the trick and I don't have to punt about with macros.

Thanks a bunch,

RunsWithKnives
 

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