Google Sheets – QUERY Formula Excludes Results with New Line

formulasgoogle sheetsgoogle-sheets-query

It seems there may be a bug in Google Sheets' Query formula where results with a new line character (char 10) are excluded when the column is filtered. Is there any way around this or am I doing something wrong?

source data in columns A:C, query formula in E1 doesn't return rows 5 or 6 even though the filter criteria says they should.

Best Answer

  • this is not a fault of CHAR(10) nor bug
  • by examining the whole range with =ARRAYFORMULA(ISNUMBER(A2:C7)) you can see that CHAR(10) causes cells with numbers to act like TEXT which makes sense because there is not a number like 19 68 it's either 19, 68 or 1968

  • therefore, you will need to use such query that works with text not with numbers:

    =QUERY(A1:C7, "select A,B,C where B contains '2'")

    enter image description here