Home > database >  google sheet query error AVG_SUM_ONLY_NUMERIC
google sheet query error AVG_SUM_ONLY_NUMERIC

Time:02-02

Hi I use this query formula in google sheet and it works good as long as there is values in column E,F,G =Query('CM Invoice Report'!A10:G,"Select C,Sum(E),Sum(F),Sum(G) where C is not null Group By C Label C'', Sum(E)'', Sum(F)'', Sum(G)''",0)

the problem is if one of the column as no value I get #VALUE AVG_SUM_ONLY_NUMERIC error so I tried adding an iferror to the formula as suggested in many post but I just can't seem to get it to work. PS. I've also tried replacing column C,E,F,G with Col3,Col5,Col6,Col7 and still nothing. Here's the other formula I've tried.

=Query({Iferror(query('CM Invoice Report'!A10:G,"Select C,Sum(E),Sum(F),Sum(G) where C is not null Group By (C) Label C'', Sum(E)'', Sum(F)'', Sum(G)''",0),{"","","",""})})

Any help would be greatly appreciated

CodePudding user response:

It's possible that in one of the columns you have many text values? If that's so, QUERY is possibly handling that column as text, considering the actual numbers as text. You may try converting them to its numeric value; IFERROR will exclude those that are really text:

=Query({'CM Invoice Report'!C10:C,INDEX(IFERROR(VALUE('CM Invoice Report'!E10:G)))},"Select Col1,Sum(Col2),Sum(Col3),Sum(Col4) where Col1 is not null Group By Col1 Label Col1 '', Sum(Col2) '', Sum(Col3)'', Sum(Col4)''",0)
  • Related