Search code examples
google-sheetsconcatenationgoogle-sheets-formulaarray-formulasgoogle-sheets-query

Concatenate columns inside ArrayFormula, excluding certain values


Please see the Google Sheet at the link below. In column 'F', I need to use an ARRAYFORMULA to combine the values from columns 'B' through 'E', separating the values with commas, and excluding the values that read "No". Column G shows the desired output of the ARRAYFORMULA.

https://docs.google.com/spreadsheets/d/11GMOU0I4v1TcyBAnTDKPfccGWO9LYoM8_wz6hx_JXg0/edit?usp=sharing

Edit: Both answers below solve the problem. Thanks to you both!


Solution

  • You can use

    =ArrayFormula(IF(LEN(B2:B)>0, REGEXREPLACE(transpose( 
                 query(transpose({B2:C, E2:E, G2:G})&",",,9^9)),"(No, )|(, No)|(,$)",""),""))
    

    enter image description here