Search code examples
if-statementgoogle-sheetsgoogle-sheets-formulatrimgoogle-query-language

Sheets Merge Multiple Rows into 1 Row


I have multiple rows, each containing cells that do not overlap and I want to easily merge them into a single row with a formula. Bonus if I can also fill in the empty cells with something. In this case the text "off". All in a single formula.

enter image description here


Solution

  • try:

    =INDEX(TRIM(QUERY(B2:H7;;9^9)))
    

    and:

    =INDEX(IF(TRIM(QUERY(B2:H7;;9^9))=""; "off"; TRIM(QUERY(B2:H7;;9^9)))