Without using a pivot table, how can I transpose headers into one column where there is data in the cell for that row

NRogalska

New Member
Joined
Sep 1, 2023
Messages
2
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
List of data col A with different values input into the appropriate col C-F. I want to have B reference the column header the value is in.

So in this example rows A2-A8 are my line items where their values are recorded in the appropriate product column, and I want that product column header to be shown in column B next to the appropriate line item: here Item A3 has a value recorded in col with header D1 so 'D1' appears in the cell next to item A3.

ItemProductC1D1E1F1G1H1
A2F1
2​
A3D1
3​
A4G1
4​
A5C1
5​
A6E1
6​
A7D1
7​
A8H1
8​

I know I can do this manually by filtering each column excluding blank cells, and then copy/paste the col header into the remaining cells in col B, but this is quite laborious and I'd like a formula to do it so it happens everytime a new line/row is added with data.
I know I could use a very long 'if' or 'ifs' formula but hoping for something simpler.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Give this a try...

Book1
ABCDEFGH
27ItemProductC1D1E1F1G1H1
28A2F12
29A3D13
30A4G14
31A5C15
32A6E16
33A7D17
34A8H18
Sheet1
Cell Formulas
RangeFormula
B28:B34B28=FILTER($C$27:$H$27,C28:H28<>"","error")


Hope that helps,

Doug
 
Upvote 0
Another option
Fluff.xlsm
ABCDEFGH
1ItemProductC1D1E1F1G1H1
2A2F12
3A3D13
4A4G14
5A5C15
6A6E16
7A7D17
8A8H18
Master
Cell Formulas
RangeFormula
B2:B8B2=LOOKUP(2,1/(C2:H2<>""),$C$1:$H$1)
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,954
Members
449,096
Latest member
Anshu121

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