Find the heading for the first value in a looked up row

SoniaL

New Member
Joined
Apr 4, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I'm trying to get a heading for a row where there's a value, where I also need to lookup which row to search in.

This visual may be helpful. I am trying to populate the yellow cells in the top table with the headings from the bottom table
So logically the steps are:
1) Using the "Lookup Value", find the corresponding row in the second table
2) With that row, find the first OR next non-blank cell
3) Then return the heading of that column

1649108497247.png


Is this possible to do in a formula?

Thanks

Sonia
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Maybe this, I'm not sure if this is what your goal is?

Book1
ABCDEFGH
1Heading Name 1Heading Name 2Heading Name 3
2Lookup Value 1   
3Lookup Value 2Return for Lookup 1Heading 6 
4Lookup Value 3   
5Lookup Value 4   
6Lookup Value 5Col 5 Heading  
7
8Heading Name 1Heading Name 2Heading Name 3Return for Lookup 1Heading 5Heading 6Col 5 Heading
9Lookup Value 1
10Lookup Value 258
11Lookup Value 3
12Lookup Value 4
13Lookup Value 5a
14Lookup Value 6
15Lookup Value 7
16
Sheet1
Cell Formulas
RangeFormula
B2:D6B2=IFERROR(INDEX($B$8:$H$8,SMALL(IF(($B$9:$H$15<>"")*($A$9:$A$15=$A2),COLUMN($B$8:$H$8)-COLUMN($B$8)+1),COLUMNS($B2:B2))),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Another option
Excel Formula:
=FILTER($B$8:$H$8,FILTER($B$9:$H$15,$A$9:$A$15=A2)<>"","")
 
Upvote 0
Maybe this, I'm not sure if this is what your goal is?

Book1
ABCDEFGH
1Heading Name 1Heading Name 2Heading Name 3
2Lookup Value 1   
3Lookup Value 2Return for Lookup 1Heading 6 
4Lookup Value 3   
5Lookup Value 4   
6Lookup Value 5Col 5 Heading  
7
8Heading Name 1Heading Name 2Heading Name 3Return for Lookup 1Heading 5Heading 6Col 5 Heading
9Lookup Value 1
10Lookup Value 258
11Lookup Value 3
12Lookup Value 4
13Lookup Value 5a
14Lookup Value 6
15Lookup Value 7
16
Sheet1
Cell Formulas
RangeFormula
B2:D6B2=IFERROR(INDEX($B$8:$H$8,SMALL(IF(($B$9:$H$15<>"")*($A$9:$A$15=$A2),COLUMN($B$8:$H$8)-COLUMN($B$8)+1),COLUMNS($B2:B2))),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Yes! Exactly this!!! Thank you!!
 
Upvote 0

Forum statistics

Threads
1,215,586
Messages
6,125,686
Members
449,249
Latest member
ExcelMA

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