1
votes

This is the original query:

QUERY(IMPORTRANGE("sheet_name", "Social media posts!A:AS"),"SELECT Col1, Col14, Col12, Col10, Col23, Col16, Col13, Col37, Col2, Col3 WHERE Col2='instagram'") enter image description here

Output of the original query. Please check column H, which has empty cells.

I was trying to subquery the original query with this formula:

=QUERY(QUERY(IMPORTRANGE("sheet_name", "Social media posts!A:AS"),"SELECT Col1, Col14, Col12, Col10, Col23, Col16, Col13, Col37, Col2, Col3 WHERE Col2='instagram'", 1),"SELECT Col1, SUM(Col2)/Count(Col10), SUM(Col3)/Count(Col10), SUM(Col4)/Count(Col10), SUM(Col5)/Count(Col10), SUM(Col6)/Count(Col10), SUM(Col7)/Count(Col10) group by Col1")

This formula works. However, when i try to add SUM(Col8)/Count(Col10) before the "group by", it doesnt work. Col8 is H column. Error message is :

Unable to parse query string for Function QUERY parameter 2: AVG_SUM_ONLY_NUMERIC

1
H is not numeric. So it can't sum. Also, where is Google apps script in this? It's just query formula.TheMaster

1 Answers

2
votes

The AVG_SUM_ONLY_NUMERIC error means you are trying to do an arithmetic operations on non-numeric data.

Column H looks blank in your screenshot. Perhaps you can test it when there is real data in there?