# Thread: How to add a condition to COUNTIFS formula to exclude certain numbers? Thanks: 0 Likes: 0

1. ## Re: How to add a condition to COUNTIFS formula to exclude certain numbers?

Ah, oops, thanks!

2. ## Re: How to add a condition to COUNTIFS formula to exclude certain numbers?

So, now I'm trying to take the average of the numbers in the same setup, and I tried adapting your formula to the AVERAGEIFS function, but I'm getting the #VALUE ! error again which says "A value used in the formula is of the wrong data type":

=AVERAGEIFS(Scores!\$B\$2:\$I\$5,Scores!\$B2:\$I2,"<70",INDEX(Calendar!\$B\$2:\$I\$5,MATCH(Scores!\$A2,Calendar!\$A\$2:\$A\$5,0),0),"<>x")

I'm suspecting that the issue is caused by the initial range of the function "
Scores!\$B\$2:\$I\$5"
perhaps?

Thanks a lot!

3. ## Re: How to add a condition to COUNTIFS formula to exclude certain numbers?

Shouldn't that be
AVERAGEIFS(Scores!\$B2:\$I2,Scores!\$B2:\$I2

4. ## Re: How to add a condition to COUNTIFS formula to exclude certain numbers?

Ah I see! I don't know why I was thinking the initial range refers to the entire range the formula will scan, so I was including the lower rows too.

That's it for now until I encounter other conditions

Thanks a lot!!!

5. ## Re: How to add a condition to COUNTIFS formula to exclude certain numbers?

You're welcome & thanks for the feedback