Concatenate question

Y

yovation

I tried posting this yesterday but haven't seen it.

I am using this formula to concatenate.

=(A1&", "&B1&", "&C1&", "&D1&", "&E1&", "&F1&", "&G1&", "&H1)

Some of the cells are blank. How can I change the formula so the
double commas ', , ' won't show.

Thank you.
David
 
T

Tom Ogilvy

=(A1&", "&B1&", "&C1&", "&D1&", "&E1&", "&F1&", "&G1&", "&H1)

where you have A1&", "& change to

if(A1="","",A1&", ")

Do it for each similar segment in including H1 so H1 will also have a ", "

Let's call that the newformula (without the equal sign).

then do

=Left(newformula,len(newformula)-2)

If all the cells could be blank

=if(counta(A1:H1)=0,"",Left(newformula,len(newformula)-2))
 
V

Vergel Adriano

assuming your formula is in column I, maybe try something like this in column
J:

=LEFT(SUBSTITUTE(I1, " ,", ""), LEN(SUBSTITUTE(I1, " ,", ""))-2)
 
K

Ken

David

Replace all the " , " with an if statement that checks the cell to the
left and puts a blank instead of " , " if the cell is blank. For
example:

=A1&IF(a1<>"",",","")&B1&IF(b1<>"",",","")&C1&IF(C1<>"",",","")&D1

Good luck.

Ken
Norfolk, Va
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top