I have data of jobs (A), their executions (B) and duration (C) in my Google Sheet. I have already calculated the average duration of each job with Query language:
SELECT A, B, AVG(C) GROUP BY A, B
How do I calculate standard deviation?
I found the discussion suggesting usage of ARRAYFORMULA
and calculating standard deviation from original math equations but I'm looking for a simpler solution.
Best Answer
It always helps to be able to see the actual sheet and data. However, you can run STDEV on a QUERY or on the data it produces.
So let's say you have your QUERY in E2:
=QUERY(A:C, "Select A, B, AVG(C) GROUP BY A, B)
That would put your numbers in Column G. So, say in H2, you could use
=STDEV(G2:G)
.Alternatively — if you didn't need to see the original QUERY output, just the STDEV of it — you could run the STDEV on a QUERY of the QUERY itself:
=STDEV(QUERY(QUERY(A:C, "Select A, B, AVG(C) GROUP BY A, B), "SELECT Col3"))
Based on your data, you may need STDEVP instead of STDEV.