Noah
Noah

Reputation: 27

Google Sheets Query and Comma Separated Data

I have a simple data query in a Google Sheet:

=query('2019'!$A$2:$A,"select A")

The data in column A has multiple cells that contain comma-separated values. Only the data in the first cell (A2) returns with all of the comma-separated values. How do I get all of the data returned in this query?

Upvotes: 0

Views: 3139

Answers (2)

player0
player0

Reputation: 1

try like this:

=ARRAYFORMULA(QUERY(TO_TEXT(2019!A2:A), "select A", 0)

Upvotes: 0

Wicket
Wicket

Reputation: 38130

It's very likely the problem is cause because the data without commas are of ty numbers, boolean, dates, time, duration, in other works, they are not text values.

This happens because QUERY assigns a data type for each column based on a sample of each column data. If the column includes data of different type, they aren't included.

The way to solve this is to prior adding the data to QUERY convert all the column values to the same data type, in this case all should be text. To force that all the values are treated as text you could preppend and apostrophe / single quote. Other methods are

  • set the cell number formatting to plain text
  • concatenate the cell value to an empty text "" like =A1&""

Upvotes: 1

Related Questions