简体   繁体   中英

How to use Arrayformula to calculate the average with a double condition

Link to spreadsheet

I have a list of names with a "score" and a code column. I would like to calculate the average of the scores for each name divided by code. I would like to do it using Arrayformula

I have tried the following formula but it doesn't expand:

=ArrayFormula(SUMIFS(B:B,A:A,G2:G,C:C,"Z1")/COUNTIF(FILTER(A:C,A:A=G2,C:C="Z1"),G2:G))

I think it's because of SUMIFS but I couldn't find any way to replace it.

Thank you

Aresvik solution works well but I would like to calculate the average only if the scores are typed in. currently, the formula counts also the empty cells. I tried the following formula but it didn't work

=ArrayFormula(if(G2:G<>"",iferror(SUMIF(A2:A&C2:C,G2:G&H$1,B2:B)/COUNTIFS(A2:A&C2:C&B:B,G2:G&H$16">0"),),))

Try this in cell H2:

=ArrayFormula(if(G2:G<>"",iferror(SUMIF(A2:A&C2:C,G2:G&H$1,B2:B)/COUNTIFS(A2:A&C2:C,G2:G&H$1,B2:B,"<>"),),))

and this in cell I2:

=ArrayFormula(if(G2:G<>"",iferror(SUMIF(A2:A&C2:C,G2:G&I$1,B2:B)/COUNTIFS(A2:A&C2:C,G2:G&I$1,B2:B,"<>"),),))

SUMIFS isn't compatible with ARRAYFORMULA .

在此处输入图像描述

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM