how to concatenate a string but with some ifs?

jamiguel77

Active Member
Joined
Feb 14, 2006
Messages
322
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
  2. Web
hi all

i have this data:
A1B1C1D1E1F1G1
1​
329

I WANT CONCATENATE:

A3=Concatenate(A1,", ",B1,", ",C1,", ",D1,", ",E1,", ",F1,", ",G1)

and the result is: 1, 3, 29, , , ,

i want ignore empty cells and the result that i need is: 1, 3, 29

how to do?

thanks
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

AhoyNC

Well-known Member
Joined
Oct 10, 2011
Messages
4,860
Office Version
  1. 365
Platform
  1. Windows
In Excel versions 2010 and higher try the TEXTJOIN function.

Book2
ABC
11329
2
31, 3, 29
Sheet1
Cell Formulas
RangeFormula
B3B3=TEXTJOIN(", ",1,A1:G1)
 

jamiguel77

Active Member
Joined
Feb 14, 2006
Messages
322
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
  2. Web
Sorry i Use Excel 2016 and not see the function, thanks

any other way?
 

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
11,541
TEXTJOIN is only available in Excel 2019 and above. Try this:

Book1
ABCDEFGHI
113291, 3, 29
24674, 6, 7
365432106, 5, 4, 3, 2, 1, 0
Sheet13
Cell Formulas
RangeFormula
I1:I3I1=SUBSTITUTE(TRIM(A1&" "&B1&" "&C1&" "&D1&" "&E1&" "&F1&" "&G1)," ",", ")
 

Forum statistics

Threads
1,144,158
Messages
5,722,824
Members
422,460
Latest member
VBA_Noob01

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
Top