ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to find copy "header" and paste (https://www.excelbanter.com/excel-discussion-misc-queries/79757-macro-find-copy-header-paste.html)

RunsWithKnives

Macro to find copy "header" and paste
 
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

Biff

Macro to find copy "header" and paste
 
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

"RunsWithKnives" wrote in message
...
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




RunsWithKnives

Macro to find copy "header" and paste
 
Hey Cheers Biff,
that does the trick and I don't have to punt about with macros.

Thanks a bunch,

RunsWithKnives


"Biff" wrote:

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

"RunsWithKnives" wrote in message
...
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





Biff

Macro to find copy "header" and paste
 
You're welcome. Thanks for the feedback!

Biff

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

Thanks a bunch,

RunsWithKnives


"Biff" wrote:

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

"RunsWithKnives" wrote in
message
...
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








All times are GMT +1. The time now is 04:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com