I'm getting a '#Value!' error when I try to sort data returned by a QUERY
statement. This is the basic statement:
=query('Raw Data'!A:G,"Select A, C, D, sum(G) where B='instagram' and (D='Female Followers Age' or D='Male Followers Age') and A <> '#N/A' group by D, C, A label A 'Handle', C 'Country', D 'Segment', sum(G) 'Share'",0)
Adding an ORDER BY
statement to the end of it to sort on column A generates a #Value! error. I saw some responses on forums suggesting column numbers should be used in place of letters with the order by clause. However, I have tried replacing order by A
with order by 1
, but it generates the same error.
=query('Raw Data'!A:G,"Select A, C, D, sum(G) where B='instagram' and (D='Female Followers Age' or D='Male Followers Age') and A <> '#N/A' group by D, C, A label A 'Handle', C 'Country', D 'Segment', sum(G) 'Share' order by A",0)