Reputation: 534
I have a table with an ID column and 6 other value columns:
A B C D E F G
ID Col1 Col2 Col3 Col4 Col5 Col6
001 123 456 789
002 901 234 567 890 123 456
I'm looking for a formula that will concatenate the ID with what ever columns have values, separate by dashes (in this example).
ie.
=CONCATENATE(A2,"-",B2,"-",C2,"-",D2,"-",E2,"-",F2,"-",G2)
Only, I don't want to put dashes next to cells that don't have any value in it.
The desired output should look like this
001-123-456-789
002-901-234-567-890-123-456
With the formula I used, it looks like this:
001-123-456-789---
002-901-234-567-890-123-456
Upvotes: 0
Views: 2531
Reputation: 166
For examples :
=IF(A2<>"","-"&A2,"")&IF(B2<>"","-"&B2,"")&IF(C2<>"","-"&C2,"")&IF(D2<>"","-"&D2,"")&IF(F2<>"","-"&F2,"")&IF(G2<>"","-"&G2,"")
Upvotes: 2