Formula to provide heading names for a specific cell in a table

Willie77

New Member
Joined
Aug 24, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I have a table A1:F6 with 5 rows and 5 columns of data and with column headings (B1:F1) and row headings (A2:A6). I want to find the heading names for cell D5. All heading names are unique.
What formula can I use to find the column heading name (D1) for the value in cell D5?
What formula can I use to find the row heading name (A5) for the value in cell D5?
Screen 2024-08-24 21.48.41.jpg
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Is there a bit more to this?
If it's always D5, then =D1 will give you your column heading and =A5 will give you your row heading
 
Upvote 0
Try:
This assumes the value in I2 will be unique.

Book1
ABCDEFGHI
1col1col2col3col4col5Ite mFormula
2Row 11533111490Cell 0594
3Row 25651835845Col Headingcol3
4Row 32222923636Row HeadingRow 4
5Row 46213947712
6Row 51863554634
Sheet1
Cell Formulas
RangeFormula
I3I3=INDEX($B$1:$F$1,SUMPRODUCT(($B$2:$F$6=$I$2)*(COLUMN($B$1:$F$1)-COLUMN($B$1)+1)))
I4I4=INDEX($A$2:$A$6,SUMPRODUCT(($B$2:$F$6=$I$2)*(ROW($A$2:$A$6)-ROW(A2)+1)))
 
Upvote 0
If you have to find that value anywhere in the table:

Book2
ABCDEFGHI
1col1col2col3col4col5Ite mFormula
2Row 11533111490Cell 0594
3Row 25651835845Col Headingcol3
4Row 32222923636Row HeadingRow 4
5Row 46213947712
6Row 51863554634
Sheet1
Cell Formulas
RangeFormula
I3I3=TEXTJOIN("",TRUE,IF(B2:F6=I2,B1:F1,""))
I4I4=TEXTJOIN("",TRUE,IF(B2:F6=I2,A2:A6,""))
 
Upvote 0
Solution
Try:
This assumes the value in I2 will be unique.

Book1
ABCDEFGHI
1col1col2col3col4col5Ite mFormula
2Row 11533111490Cell 0594
3Row 25651835845Col Headingcol3
4Row 32222923636Row HeadingRow 4
5Row 46213947712
6Row 51863554634
Sheet1
Cell Formulas
RangeFormula
I3I3=INDEX($B$1:$F$1,SUMPRODUCT(($B$2:$F$6=$I$2)*(COLUMN($B$1:$F$1)-COLUMN($B$1)+1)))
I4I4=INDEX($A$2:$A$6,SUMPRODUCT(($B$2:$F$6=$I$2)*(ROW($A$2:$A$6)-ROW(A2)+1)))
I2 is not unique. There can be duplicates in the table.
 
Upvote 0
If you have to find that value anywhere in the table:

Book2
ABCDEFGHI
1col1col2col3col4col5Ite mFormula
2Row 11533111490Cell 0594
3Row 25651835845Col Headingcol3
4Row 32222923636Row HeadingRow 4
5Row 46213947712
6Row 51863554634
Sheet1
Cell Formulas
RangeFormula
I3I3=TEXTJOIN("",TRUE,IF(B2:F6=I2,B1:F1,""))
I4I4=TEXTJOIN("",TRUE,IF(B2:F6=I2,A2:A6,""))
There can be duplicate numbers in the table. I want a column/row heading name just for that one specific cell.
 
Upvote 0
I gave you that in Post #2
Hi Scott. When I want to find the heading name of a cell with a duplicate number in my table, then the output is as in my attached table. I want the heading names of a specific cell with or without duplicate numbers.
 

Attachments

  • Screen 2024-08-26 20.57.31.jpg
    Screen 2024-08-26 20.57.31.jpg
    51.4 KB · Views: 3
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,082
Members
453,021
Latest member
Justyna P

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