Returning a value for a non empty cell in a column

exflyer1996

Board Regular
Joined
May 25, 2009
Messages
123
Ok, I have a name in one of 9 columns (B-J). Those columns are have headings 1-9. In column A, I would like to return the heading for whichever column has the name in it. A name appears in only 1 column of each row, and it could be in any of the 9 columns. If the name moves to a different column in the future, I want column A to update accordingly.

EXAMPLE: If "SMITH" is in cell D2, I want A2 to return the value 3.

Any suggestions?

I guess the formula could read the heading number, or how many columns away from column A the name appears.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi
Maybe something like
Code:
=LOOKUP("Smith",B2:J2,COLUMN(B2:J2))

If you wanted to make it a little more dynamic, try replacing the "Smith" with a cell reference "K1", and put the required name in that cell

Code:
=LOOKUP(K1,B2:J2,COLUMN(B2:J2))

copy down as required
 
Upvote 0
Sorry, made a typo.
The formula needs a -1 on the end to give the correct column
Rich (BB code):
=LOOKUP("Smith",B2:J2,COLUMN(B2:J2))-1

Rich (BB code):
=LOOKUP(K1,B2:J2,COLUMN(B2:J2))-1
 
Upvote 0
Ok, I have a name in one of 9 columns (B-J). Those columns are have headings 1-9. In column A, I would like to return the heading for whichever column has the name in it. A name appears in only 1 column of each row, and it could be in any of the 9 columns. If the name moves to a different column in the future, I want column A to update accordingly.

EXAMPLE: If "SMITH" is in cell D2, I want A2 to return the value 3.

Any suggestions?

I guess the formula could read the heading number, or how many columns away from column A the name appears.
Here's another one...

Book1
ABCDEFGHIJ
1_123456789
23__Smith______
36_____Day___
48_______Lee_
Sheet1

This formula entered in A2 and copied down:

=MATCH("*",B2:J2,0)
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,726
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top