Need to return column heading of value in a row

jrn1392

New Member
Joined
Feb 20, 2018
Messages
8
[FONT=&quot]I have a table of days for various feelings. Ages are going down column A. In row 1, columns B through G are the feelings. For example:[/FONT]
sadhappylonely
agesfromtofromtofromto
1111011202130
2211112212231
331910192029
44189181928
5511213232433
age22
day15
resulthappy

<tbody style="box-sizing: inherit; border: 0px; margin: 0px; padding: 0px; vertical-align: top; -webkit-font-smoothing: antialiased; text-size-adjust: none;">
</tbody>
[FONT=&quot]The user will be asked for the age and the day (A10 & A 11). I need to get the column name where the number is found. The day given could be in between ranges.[/FONT]
[FONT=&quot]Can anyone help me get the result using INDEX AND MATCH.[/FONT]
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Are you open to re-arranging that table a little?
Is the first age range 0-11 or 11-21 ?
 
Upvote 0
I've assumed it's 11-21, and 0-10 just isn't included.

Delete the to columns, they're not necessary.
So you have columns
A ages
B sad
C happy
D lonely

Try
=LOOKUP(B11,INDEX(B2:D6,MATCH(B10,A2:A6),0),B1:D1)
 
Upvote 0
... Also wondering whether the numbers will always be in ascending order L to R?

Perhaps everyone is sad at the start of the month, happy in the middle and lonely at the end?

And why do the oldies get 33 days a month!
 
Upvote 0

Perhaps everyone is sad at the start of the month, happy in the middle and lonely at the end?

And why do the oldies get 33 days a month!
I'm gonna go out on a limb and guess that this isn't the real verbiage of the table. Not really about moods and ages.
 
Upvote 0
I've assumed it's 11-21, and 0-10 just isn't included.

Delete the to columns, they're not necessary.
So you have columns
A ages
B sad
C happy
D lonely

Try
=LOOKUP(B11,INDEX(B2:D6,MATCH(B10,A2:A6),0),B1:D1)


thanks. but can you also do it using INDEX and MATCH?
 
Upvote 0
... Also wondering whether the numbers will always be in ascending order L to R?

Perhaps everyone is sad at the start of the month, happy in the middle and lonely at the end?

And why do the oldies get 33 days a month!


Yes, the numbers are in ascending order L to R. It’s just a sample table.
 
Upvote 0

Forum statistics

Threads
1,212,927
Messages
6,110,724
Members
448,294
Latest member
jmjmjmjmjmjm

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