Concatenate,IF

  • Thread starter Thread starter CS
  • Start date Start date
C

CS

I have a worksheet that currently has 2
columns:AssemblyComments and GenComments. I want to
concatenate the 2 and prefix with label but only if there
is data in that column.
ex: AssemblyComments=Small nick on bottom and
Comments=Color Variation. I want it concatenated
as "Assembly:Small nick on bottom,Gen:Color variation".
I'm not sure how to incorporate the IF statement. Thanks
for the help.
 
You say only if there's data in that column, but you are talking about two
columns, right?

If you're talking about ensuring there's data in each column (A and B here),
try;

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

if it's just one column you want to check,

=IF(A1<>"",A1&","&B1,"")
 
Almost there. I tried adding the prefix to indicate where
the data came from:
=IF(AND G50<>"",S50<>""),
"Assembly:"&G50&","&"GenComments:"&S50,"")
But if I have comments in G50 but not in S50 I get:
Assembly:Testing,GenComments:
and if I have comments in S50 but not in G50 I get nothing.
 
"AND G50" is not right- AND is a function and works on things within
parentheses;

=IF(AND(G50<>"",S50<>""),"Assembly:"&G50&","&"GenComments:"&S50,"")
 
Back
Top