Combine Columns

Boba Fetts

New Member
Joined
Mar 31, 2020
Messages
5
Office Version
  1. 365
Platform
  1. MacOS
I have a spreadsheet where I need to combine 9 columns. These columns contain words, not data. All 9 columns need to be combined into one column so I can upload to my CRM system. Some columns contain information, some do not and are left blank. I can combine the rows using CONCATENATE but here's the issue. I need the words separated by a comma and a space for readability. But, when I use the formula it adds a space and comma where there are cells that do not contain information. How do I write a formula so Excel just ignores the cells without data and only uses the cells with data? Right now the results look something like this:
1585684023776.png
 
If they were totally empty you would get something like

+Fluff.xlsm
GHIJKLMNOP
2SK055741DerbyshireCorbarE05010629EnglandE10000007SK055741, Derbyshire, Corbar, E05010629, England, E10000007
Master
Cell Formulas
RangeFormula
P2P2=TEXTJOIN(", ",TRUE,G2:O2)


in an unused cell put =ISBLANK(I2) (change I2 to reflect one of your blank cells). What does it return?
 
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Just an alternative
I took the following data and loaded to Power Query
Book1
ABCDEFG
1Column1Column2Column3Column4Column5Column6Column7
2ABCDEFGH
3FFGGHHI
Sheet1

ran the following Mcode
VBA Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}}),
    #"Merged Columns" = Table.CombineColumns(#"Changed Type",{"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7"},Combiner.CombineTextByDelimiter(", ", QuoteStyle.None),"Merged"),
    #"Replaced Value" = Table.ReplaceValue(#"Merged Columns",", ,",", ",Replacer.ReplaceText,{"Merged"})
in
    #"Replaced Value"

and the result looks like the following

Book1
A
1Merged
2AB, CD, EF, G, H
3FF, GG, HH, I,
Sheet3
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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