I’m using a complex Google Sheets query to pull data from an ‘INPUT’ sheet into a ‘PILOT_FORAY’ sheet. The query works fine for most data types like strings, booleans, and dates. But it’s not handling numeric values correctly when they’re copied to new cells for calculations.
For example, numbers appear correctly in the results table, but when I try to sum them in another cell, I get 0. This happens even though other data types (strings, booleans, dates) can be copied and used without issues.
I think the problem is that the query is treating all values as the most common data type in the ‘INPUT’ sheet. Is there a way to modify the query so it preserves the original data types, especially for numbers? The solution needs to work regardless of which data type is most common in the input data.
Here’s a simplified version of my query:
=INDEX(LAMBDA(x, y, {y; IFERROR(HLOOKUP(y, x, SEQUENCE(COUNTA(QUERY(x, "offset 1", )), 1, 2), ))}) (QUERY(INPUT!A1:K, "select A, max(G), H where C = '7e053706-1f2b-4397-bf80-b345671d22c10' and I = 'Pilot' group by A, H pivot D", 1), {"Instance Id", IFERROR(VLOOKUP(SEQUENCE(1, 9, 7), {TABLE_CONFIG!C2:C, TABLE_CONFIG!F2:F }, 2, )), "File Id"}))
Any suggestions on how to modify this query to fix the number handling issue would be greatly appreciated.