Search code examples
if-statementgoogle-sheetsconcatenationgoogle-sheets-formulaarray-formulas

Concatenate in Goggle sheet if NOT Blank


I have this formula in Google sheets

Basically, I want to concatenate only if Both Cells W2 and AA2 are NOT BLANK.

=IF(AND(NOT(ISBLANK(W2)),NOT(ISBLANK(AA2))),CONCATENATE(H2,"-",AA2),"")

It Concatenate me the cells because i guess W2 and AA2 have some Array formulas.

Is there a workaround this ?


Solution

  • use:

    =IF((W2<>"")*(AA2<>""), H2&"-"&AA2, )
    

    for AF use:

    =ARRAYFORMULA(IF((W2:W<>"")*(AA2:AA<>""), H2:H2&"-"&AA2:AA, ))