Concatenate cells and adding l sign and skip black cell

westie54

New Member
Hi

Currently I am using this formula....

=SUBSTITUTE(TRIM(D3&"^"&E3&" ^ "&F3&" ^ "&G3&" ^ "&H3&" ^ "&I3&" ^ "&J3&" ^ "&K3&" ^ "&L3&" ^ "&M3&" ^ "&N3&" ^ "&O3&" ^ "&P3&" ^ "&Q3&" ^ "&R3&" ^ "&S3&" ^ "&T3&" ^ "&U3&" ^ "&V3&" ^ "&W3&" ^ "&X3&" ^ "&Y3&" ^ "&Z3),"^", " l ")

But the issue is it substitute ^ with l so I got as a result....

l l l l Apple & Pear l l Flower & Nature l l l l l l l l l

If I replace ^ with blank (" "), " l " would replace all the spaces so the result will be like below which is not what I want.
 Apple l & l Pear l Flower l & l Nature

<tbody>
</tbody>

<tbody>
</tbody>
What I am after is Apple & Pear l Flower & Nature

Can anyone advise me what formula to us please?

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
If l l l l Apple & Pear l l Flower & Nature l l l l l l l l l is in A1

=SUBSITUTE(SUBSITUTE(TRIM(SUBSITUTE(SUBSITUTE(A1," & ",CHAR(5)),"|" " "))," ","|"),CHAR(5), " & ")

Hi Mike,

The data that I want to draw data from is from column D2 to Z2. Do I need to repeat the A1," & ",CHAR(5) to get a complete formula? Sorry if my question sounds silly (this shows how little I know about excel). Thank you.

The formula that you are currently using:

=SUBSTITUTE(TRIM(D3&"^"&E3&" ^ "&F3&" ^ "&G3&" ^ "&H3&" ^ "&I3&" ^ "&J3&" ^ "&K3&" ^ "&L3&" ^ "&M3&" ^ "&N3&" ^ "&O3&" ^ "&P3&" ^ "&Q3&" ^ "&R3&" ^ "&S3&" ^ "&T3&" ^ "&U3&" ^ "&V3&" ^ "&W3&" ^ "&X3&" ^ "&Y3&" ^ "&Z3),"^", " l ")

I'm not sure why you are going through the carets, but to get a delimited string that preserves the existing spaces, you could replace each of those cell references with
SUBSTITUTE(D3," ",CHAR(5))
SUBSTITUTE(E3," ",CHAR(5))
SUBSTITUTE(F3," ",CHAR(5))
And use the (shortened) formula
=SUBSITUTE(SUBSTITUTE(TRIM(SUBSTITUTE(D3," ",CHAR(5))&" "&SUBSTITUTE(E3," ",CHAR(5))&" "&SUBSTITUTE(F3," ",CHAR(5))), " ", " | "), CHAR(5), " ")

On the other hand, it would be much much easier to have a helper row

in D4 put the formula =D3
In E4 put the formula =IF(D4="", E3, IF(E3="", D4, D4 & " | " & E3)

Then drag right.

Replies
7
Views
167
Replies
1
Views
268
Replies
3
Views
372
Replies
8
Views
382
Replies
11
Views
707

Threads
1,203,538
Messages
6,055,992
Members
444,839
Latest member
laurajames

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

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