'How to Calculate Conditional Correlation in Google Sheets

Here is my screenshot and link to the spreadsheet. I am trying to calculate the correlation between number of passes students take and their grades, but only for those with greater than 60% attendance. I am not sure what is wrong with my formula. Sheet enter image description here



Solution 1:[1]

There are several things wrong with your formula, including that you are using range references (e.g., "B2:B98") where QUERY only calls for "B"; but rather than telling you what is wrong, I'll just share what should be right as well as easier for you:

=ArrayFormula(CORREL(FILTER(B2:B,A2:A>0.6),FILTER(C2:C,A2:A>0.6)))

If you want to stick with QUERY:

=ArrayFormula(CORREL(QUERY(A2:C,"Select B WHERE A > 0.6"),QUERY(A2:C,"Select C WHERE A > 0.6")))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1