COUNTIFS With Lists Of Multiple Criteria

excelbytes

Active Member
Joined
Dec 11, 2014
Messages
251
Office Version
  1. 365
Platform
  1. Windows
I have the following formula in cell O2:

=SUM(COUNTIFS(Table2[Customer],$Y$3#,Table2[Market],$Z$3#,Table2[Function],DCP[[#Headers],[Project Manager]]))

Y3 has this formula which generates a list of unique Customers from a filtered table DCP:

=UNIQUE(FILTER(DCP[Customer],SUBTOTAL(3,OFFSET(DCP[[#Headers],[Customer]],ROW(DCP[Customer])-ROW(DCP[[#Headers],[Customer]]),0))))

Z3 has this formula which generates a list of unique Markets from a filtered table DCP:

=UNIQUE(FILTER(DCP[Market],SUBTOTAL(3,OFFSET(DCP[[#Headers],[Market]],ROW(DCP[Market])-ROW(DCP[[#Headers],[Market]]),0))))

When I have only one Customer in Y and one or multiple Markets in Z, it works fine, but when I have multiple Customers, I get incorrect results.

Any suggestions as to how I can modify my formula to accomplish what I am trying to do, which is get a count based on criteria of two lists plus a third single criteria. Is this possible?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
How about
Excel Formula:
=SUM(COUNTIFS(Table2[Customer],torow($Y$3#),Table2[Market],$Z$3#,Table2[Function],DCP[[#Headers],[Project Manager]]))
 
Upvote 0
Solution
Fluff, that appears to work! I am familiar with the TOROW function, but WHY does it work in this scenario?
 
Upvote 0
When using two arrays one has to be vertical & the other horizontal.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,133
Messages
6,123,235
Members
449,092
Latest member
SCleaveland

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