Combine headers from array

Morgzord

New Member
Joined
Jun 4, 2015
Messages
2
I'm trying to combine a series of headers in an option array with a | delimiter between them.

I can get the delimiter in quite easy with a series of IF arguments, but I cannot figure out how to get rid of the leading delimiter.

The original forumala I used was:

=IF(ISTEXT(B2),$B$1,"")&IF(ISTEXT(C2),"|"&$C$1,"")&IF(ISTEXT(D2),"|"&$D$1,"")&IF(ISTEXT(E2),"|"&$E$1,"")

I got to:

=IF(ISTEXT(L6),$L$1,"")&IF(ISTEXT(M6),IF(ISBLANK(L6),"","|")&$M$1,"")&IF(ISTEXT(N6),IF(ISBLANK(L6:M6),"","|")&$N$1,"")&IF(ISTEXT(O6),IF(ISBLANK(L6:N6),"","|")&$O$1,"")

but the range wouldn't work. Obviously this is with the existing worksheet cell refs.

Table below, any help appreciated :)



Item OptionsMatrix ColourMatrix SizeMatrix StoneMatrix Material
|Matrix Size|Matrix Material U60 SIL
Matrix Colour|Matrix Size|Matrix StoneREDU90TUQ
|Matrix Material GOL
|Matrix Size|Matrix Material U60 SIL

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I'm trying to combine a series of headers in an option array with a | delimiter between them.

I can get the delimiter in quite easy with a series of IF arguments, but I cannot figure out how to get rid of the leading delimiter.

The original forumala I used was:

=IF(ISTEXT(B2),$B$1,"")&IF(ISTEXT(C2),"|"&$C$1,"")&IF(ISTEXT(D2),"|"&$D$1,"")&IF(ISTEXT(E2),"|"&$E$1,"")
I am not sure what your second formula is doing, so let's work with your original formula (above). The key to making it work is to make the first item in the concatenation the same as all the rest, that way you are guaranteed to have a leading delimiter under all circumstance, then you can get rid of it using the MID function....

=MID(IF(ISTEXT(B2),"|"&$B$1,"")&IF(ISTEXT(C2),"|"&$C$1,"")&IF(ISTEXT(D2),"|"&$D$1,"")&IF(ISTEXT(E2),"|"&$E$1,""),2,99)
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,757
Members
449,094
Latest member
dsharae57

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