How to add a condition to COUNTIFS formula to exclude certain numbers?

Rnkhch

Well-known Member
Joined
Apr 28, 2018
Messages
578
Office Version
  1. 365
Platform
  1. Windows
Hello,

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

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Dates[/TD]
[TD]3/4/2019[/TD]
[TD]3/11/2019[/TD]
[TD]3/18/2019[/TD]
[TD]3/25/2019[/TD]
[TD]4/1/2019[/TD]
[TD]4/8/2019[/TD]
[TD]4/15/2019[/TD]
[TD]etc.[/TD]
[/TR]
[TR]
[TD]Student1[/TD]
[TD]71[/TD]
[TD]68[/TD]
[TD]78[/TD]
[TD]92[/TD]
[TD]79[/TD]
[TD]96[/TD]
[TD]73[/TD]
[TD]etc.[/TD]
[/TR]
[TR]
[TD]Student2[/TD]
[TD]56[/TD]
[TD]71[/TD]
[TD]68[/TD]
[TD]75[/TD]
[TD]70[/TD]
[TD]81[/TD]
[TD]77[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Student3[/TD]
[TD]79[/TD]
[TD]91[/TD]
[TD]89[/TD]
[TD]89[/TD]
[TD]94[/TD]
[TD]90[/TD]
[TD]92[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]etc.[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

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:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Dates:[/TD]
[TD]3/4/2019[/TD]
[TD]3/11/2019[/TD]
[TD]3/18/2019[/TD]
[TD]3/25/2019[/TD]
[TD]4/1/2019[/TD]
[TD]4/8/2019[/TD]
[TD]4/15/2019[/TD]
[TD]etc.[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Thanks for any input!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
How about
=COUNTIFS(B2:I2,"<70",Calendar!B2:I2,"<>x")
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
What if each student has their own "Calendar" sheet criteria such as below:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Dates:[/TD]
[TD]3/4/2019[/TD]
[TD]3/11/2019[/TD]
[TD]3/18/2019[/TD]
[TD]3/25/2019[/TD]
[TD]4/1/2019[/TD]
[TD]4/8/2019[/TD]
[TD]4/15/2019[/TD]
[TD]etc.[/TD]
[/TR]
[TR]
[TD]Student1[/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Student2[/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Student3[/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]etc.[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Thanks a lot!:)
 
Upvote 0
How about
=COUNTIFS(B2:I2,"<70",INDEX(Calendar!$B$2:$I$4,MATCH(A2,Calendar!$A$2:$A$5,0),0),"<>x")
 
Upvote 0
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 :)
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
I'm trying to use your formula from the "Main" Sheet, and I made adjustments as follows, but I'm getting the #VALUE ! error:

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]=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)<strike>
</strike>
[/FONT]
 
Upvote 0
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")
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top