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

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

Hello,

I have a COUNTIFS formula [=COUNTIFS(B2:I2,"<70")] that calculates the number of times a score is less than 70, as follows:

 Dates 3/4/2019 3/11/2019 3/18/2019 3/25/2019 4/1/2019 4/8/2019 4/15/2019 etc. Student1 71 68 78 92 79 96 73 etc. Student2 56 71 68 75 70 81 77 Student3 79 91 89 89 94 90 92 etc.

How can I add a condition to the formula that allows to exclude scores that correspond to dates marked with an "X" within the "Calendar" sheet with the same organization as the above sheet, as follows:

 Dates: 3/4/2019 3/11/2019 3/18/2019 3/25/2019 4/1/2019 4/8/2019 4/15/2019 etc. X X X

Thanks for any input!

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

=COUNTIFS(B2:I2,"<70",Calendar!B2:I2,"<>x")

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

Sweet, thanks a lot!

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

You're welcome & thanks for the feedback

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

What if each student has their own "Calendar" sheet criteria such as below:

 Dates: 3/4/2019 3/11/2019 3/18/2019 3/25/2019 4/1/2019 4/8/2019 4/15/2019 etc. Student1 X X X Student2 X X Student3 X X etc.

Thanks a lot!

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

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

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

Amazing!! Thanks a lot!!

I might have one more condition added based on the new score sheets I have received, so I'll post if I can't figure out myself

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

You're welcome & thanks for the feedback

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

I'm trying to use your formula from the "Main" Sheet, and I made adjustments as follows, but I'm getting the #VALUE ! error:

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

Am I missing anything? Thanks a lot!

(The scores are in the "Scores" sheet)

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

You're ranges are different sizes
=COUNTIFS(Scores!B2:G2,"<70",INDEX(Calendar!\$B\$2:\$I\$4,MATCH(Scores!A2,Calendar!\$A\$2:\$A\$5,0),0),"<>x")