I have this table.

I want to calculate the average based on column B and put the value in this table.

In other words, in E4 I want to put the average of all rows where column B contained a value of 26.

The formula I have to calculate this is:

=IFERROR(SUMIFS('BDA Audit'!$S5:$S10393, 'BDA Audit'!$B5:$B10393, Statistiques!F$3)/COUNTIF('BDA Audit'!$B5:$B10393, Statistiques!F$3),"")

I also want to calculate the average YTD. That is the average of all rows from week 1 to the current week.

I tried to do this with

=IFERROR(SUMIFS('BDA Audit'!$S5:$S10393, 'BDA Audit'!$B5:$B10393, <= Statistiques!F$3)/COUNTIF('BDA Audit'!$B5:$B10393, <= Statistiques!F$3),"")

But the formula is not happy with the "<=".

To calculate the average by area (column E), I have this

=IFERROR(SUMIFS('BDA Audit'!$S$5:$S$10393, 'BDA Audit'!$E$5:$E$10393, Statistiques!$A7)/COUNTIF('BDA Audit'!$E$5:$E$10393, Statistiques!$A7),"")

But this doesn't seem to be correct.

In addition I must retrieve the rows with the top 10 scores.

Thanks in advance for your help.