Concatenate cells but exclude empties in Excel [duplicate]

I am wondering how I can concatenate a row of cells with comma separated values but exclude empty cells.

For Example the list would be:

A1 - Dog

B1 - "empty cell"

C1 - Cat

I am looking for a formula that would return ---> Dog, Cat

Really appreciate your help!


Solution 1:

With possible values in A1, B1 and C1, in D1 enter:

=IF(A1="","",A1)&IF(B1="","",IF(A1<>"",", "&B1,B1))&IF(C1="","",IF(AND(A1="",B1=""),C1,", "&C1))

This avoids using blanks and also avoids using unnecessary commas.