SUM COUNTIFS with criteria over multiple ranges

samleighcattrall

New Member
Joined
Oct 13, 2022
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I am struggling to get the below formula to work

=SUM(COUNTIFS(Salesforce!$P:$P,">="&B7,Salesforce!$P:$P,"<="&B10,Salesforce!$D:$D,">=30",Salesforce!$V:$V,"Kieran",Salesforce!$J:$J,'Specialists + PS'!$A$3:$A$8,Salesforce!$F:$F,'Specialists + PS'!$E$3:$E$5))+SUM(COUNTIFS(Salesforce!$P:$P,">="&B7,Salesforce!$P:$P,"<="&B10,Salesforce!$D:$D,">=30",Salesforce!$V:$V,"Kieran",Salesforce!$J:$J,'Specialists + PS'!$A$3:$A$8,Salesforce!$F:$F,'Specialists + PS'!$E$9,Salesforce!$H:$H,'Specialists + PS'!$H$2:$H$5))

However if I swap out the red sections with what's written in the range instead, it returns the correct values. You could say that fixes the issues, however if I want to change those ranges in the future I need to edit the formula.

=SUM(COUNTIFS(Salesforce!$P:$P,">="&B7,Salesforce!$P:$P,"<="&B10,Salesforce!$D:$D,">=30",Salesforce!$V:$V,"Kieran",Salesforce!$J:$J,'Specialists + PS'!$A$3:$A$8,Salesforce!$F:$F,{"Built to Curtilage","Network Built","Built"}))+SUM(COUNTIFS(Salesforce!$P:$P,">="&B7,Salesforce!$P:$P,"<="&B10,Salesforce!$D:$D,">=30",Salesforce!$V:$V,"Kieran",Salesforce!$J:$J,'Specialists + PS'!$A$3:$A$8,Salesforce!$F:$F,'Specialists + PS'!$E$9,Salesforce!$H:$H,{"23/24 Q4","23/24 Q3","23/24 Q2","23/24 Q1"}))
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
It's because you are already using a vertical array as criteria for another column, so you need a horizontal one for the second array:

Excel Formula:
=SUM(COUNTIFS(Salesforce!$P:$P,">="&B7,Salesforce!$P:$P,"<="&B10,Salesforce!$D:$D,">=30",Salesforce!$V:$V,"Kieran",Salesforce!$J:$J,'Specialists + PS'!$A$3:$A$8,Salesforce!$F:$F,TRANSPOSE('Specialists + PS'!$E$3:$E$5)))+SUM(COUNTIFS(Salesforce!$P:$P,">="&B7,Salesforce!$P:$P,"<="&B10,Salesforce!$D:$D,">=30",Salesforce!$V:$V,"Kieran",Salesforce!$J:$J,'Specialists + PS'!$A$3:$A$8,Salesforce!$F:$F,'Specialists + PS'!$E$9,Salesforce!$H:$H,TRANSPOSE('Specialists + PS'!$H$2:$H$5)))

or you could use FILTER since you have 365.
 
Upvote 0
It's because you are already using a vertical array as criteria for another column, so you need a horizontal one for the second array:

Excel Formula:
=SUM(COUNTIFS(Salesforce!$P:$P,">="&B7,Salesforce!$P:$P,"<="&B10,Salesforce!$D:$D,">=30",Salesforce!$V:$V,"Kieran",Salesforce!$J:$J,'Specialists + PS'!$A$3:$A$8,Salesforce!$F:$F,TRANSPOSE('Specialists + PS'!$E$3:$E$5)))+SUM(COUNTIFS(Salesforce!$P:$P,">="&B7,Salesforce!$P:$P,"<="&B10,Salesforce!$D:$D,">=30",Salesforce!$V:$V,"Kieran",Salesforce!$J:$J,'Specialists + PS'!$A$3:$A$8,Salesforce!$F:$F,'Specialists + PS'!$E$9,Salesforce!$H:$H,TRANSPOSE('Specialists + PS'!$H$2:$H$5)))

or you could use FILTER since you have 365.

Thank you Rory, I appreciate the above formula only includes two vertical ranges per sum, but if I had say 4 vertical ranges what would be the best solution?
 
Upvote 0
FILTER. You cannot do that with a COUNTIFS.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,023
Latest member
alabaz

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