CONCATENATE to exclude separators for cells that are not populated

2Took

Board Regular
Joined
Jun 13, 2022
Messages
203
Office Version
  1. 365
Platform
  1. Windows
Trying to find a sensible improvement to below formula, such that separators " | " would only be included for the cells that are in fact populated. To avoid outcomes like this:
ABC EFG - KF12345|KF54321|||||||||||||||\

But instead to get automatically result like this:
ABC EFG - KF12345|KF54321

Here's the formula I'm running:
=CONCATENATE("ABC EFG - " &K6&"|"&L6&"|"&M6&"|"&N6&"|"&O6&"|"&P6&"|"&Q6&"|"&R6&"|"&S6&"|"&L7&"|"&M7&"|"&N7&"|"&O7&"|"&P7&"|"&Q7&"|"&R7&"|"&S7&"\")
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Show us a small sample of data (8-10 records) with some cells empty. Use XL2BB so that we don't have to recreate your sample. This is a simple case for Power Query/Get and Transform Data which is on the Data Tab of your version of Excel.
 
Upvote 0
How about
Excel Formula:
="ABC EFG - "&TEXTJOIN("|",,K6:S6,L7:S7)&"\"

This is a simple case for Power Query/Get and Transform Data
But probably simpler with a basic formula. ;)
 
Upvote 0
Solution

Forum statistics

Threads
1,223,884
Messages
6,175,177
Members
452,615
Latest member
bogeys2birdies

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