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]
[TABLE="width: 706"]
<tbody style="box-sizing: inherit; border: 0px; margin: 0px; padding: 0px; vertical-align: top; -webkit-font-smoothing: antialiased; text-size-adjust: none;">[TR]
[TD] [/TD]
[TD="colspan: 2, align: center"]sad[/TD]
[TD="colspan: 2, align: center"]happy[/TD]
[TD="colspan: 2, align: center"]lonely[/TD]
[/TR]
[TR]
[TD="align: center"]ages[/TD]
[TD="align: center"]from[/TD]
[TD="align: center"]to[/TD]
[TD="align: center"]from[/TD]
[TD="align: center"]to[/TD]
[TD="align: center"]from[/TD]
[TD="align: center"]to[/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]11[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]21[/TD]
[TD="align: center"]30[/TD]
[/TR]
[TR]
[TD="align: center"]22[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]11[/TD]
[TD="align: center"]12[/TD]
[TD="align: center"]21[/TD]
[TD="align: center"]22[/TD]
[TD="align: center"]31[/TD]
[/TR]
[TR]
[TD="align: center"]33[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]29[/TD]
[/TR]
[TR]
[TD="align: center"]44[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]18[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]28[/TD]
[/TR]
[TR]
[TD="align: center"]55[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]12[/TD]
[TD="align: center"]13[/TD]
[TD="align: center"]23[/TD]
[TD="align: center"]24[/TD]
[TD="align: center"]33[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]age[/TD]
[TD]22[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]day[/TD]
[TD]15[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]result[/TD]
[TD]happy[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
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,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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