Reputation: 11
I may or may not have information in the cells that I want to concatenate. If cell a and cell be are populated, I would like cell c to have: "a, b" If cell a is populated and b is not then cell c to have: "a" If cell b is populated and a is not then cell c to have: "b" If both cell a and b are empty then cell c to be empty
I can do a simple concatenation: a1 & ", " & b1
But the simple concatenation gives results like ", oranges" or ", "
Anyone have a formula that will solve this?
Upvotes: 1
Views: 775
Reputation: 848
Let a be at E20 and b be at F20. Then the function
=IF(AND(ISBLANK(E20);ISBLANK(F20));"";IF(AND(ISBLANK(E20);NOT(ISBLANK(F20)));F20;IF(AND(NOT(ISBLANK(E20));ISBLANK(F20));E20;CONCATENATE(E20;", ";F20))))
should be appropriate for your purposes.
Upvotes: 1