need a formula to return header if cell is not blank & concatenate with cell value

josh_m

Board Regular
Joined
Mar 26, 2009
Messages
81
[TABLE="class: grid, width: 449"]
<tbody>[TR]
[TD="align: center"]robert[/TD]
[TD="align: center"]alan[/TD]
[TD="align: center"]josh[/TD]
[TD="align: center"]sara[/TD]
[TD="align: center"]concatenate w/header[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"][/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]robert (3) & alan (4) & sara (5)[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"][/TD]
[TD="align: center"]alan (2) & josh (8)[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]alan (1) & sara (6)[/TD]
[/TR]
</tbody>[/TABLE]

let me see if i can explain this clearly.
i am trying to come up with a formula for column E that if the cells in that row's range are not null, return the header value concatenated with the cell value within parentheses, separated by an ampersand.
make sense?

it's easy enough with only 4 columns to use =if(a2<>"",($a$1&" ("&a2&") & ","") & if(b2<>"".....and so on, but my spreadsheet is 21 columns wide, so was hoping an expandable formula would do the trick.

any thoughts on a formula/array that would accomplish this?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
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