Countifs with Named Lists

Bossi

New Member
Joined
Dec 28, 2010
Messages
10
Office Version
  1. 365
Platform
  1. Windows
I have a countifs formula that's basically this:

=countifs(range1,NamedList,range2,NamedList)

What I want to happen is that it'll count anytime anything in both ranges matches one of the items in the Named List.

What's actually happening is that it'll only count when both Range1 and Range2 simultaneously have the exact same list item.

I've included an image example to hopefully give a sense of what I'm trying to do. At the left I have my NamedList and each range. Then at the right I show the results I want on the left, and the results this formula is giving on the right.

I feel like I'm missing something obvious to get this to count the way I want it to, but I just can't figure it out... it feels like the code I'm using should work the way I want it to :). I'm hoping to avoid brute forcing it.

unnamed.png
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Updated! (It's Office 365)
 
Upvote 0
Thanks for that (y)
How about
Fluff.xlsm
ABCDE
1
2AliceAliceDave2
3BobAliceBob
4CharlieBobDave
5AliceCharlie
6DaveCharlie
Data
Cell Formulas
RangeFormula
E2E2=SUM(COUNTIFS(A2:A4,D2:D6)*COUNTIFS(A2:A4,C2:C6))
 
Upvote 1
That works for the question I posted! \o/

But now a follow-up as I try and adapt this to my actual spreadsheet...

So let's say I now have a third metric where I want to tally both whether someone in the NamedList was one of the people in that range, *and* an additional metric.

1728409984135.png


In this example I add an additional Winner column. Now I want to know both if Range1 and Range2 include any of the names in NamedList, and whether that pairing won as the Green Team. In this example the answer should be one.

Again, I'm guessing there's an easy tweak to your formulae but I've not yet managed to figure it out...
 
Upvote 0
How about
Fluff.xlsm
ABCDEF
1
2AliceGreenAliceDave1
3BobGreenAliceBob
4CharlieBlueBobDave
5BlueAliceCharlie
6GreenBlueDaveCharlie
Data
Cell Formulas
RangeFormula
F2F2=SUM(COUNTIFS(A2:A4,E2:E6)*COUNTIFS(A2:A4,D2:D6)*COUNTIFS(A6,C2:C6))
 
Upvote 1
Solution
That works! Thanks!!

I actually ended up trying that in my own attempt to solve it & it didn't work when I'd tried it... it turns out that if I write "Green" instead of reference to A6 then the formula doesn't work.

It's easy to work around that, but now I'm puzzling over why the formula seems to have issues with that distinction. It's just a curiosity at this point in case you happen to know the answer, but no worries if that's in the category of "Excel sometimes has weird quirks & that's just the way it is"
 
Upvote 0
The first argument of countifs must be a range.
 
Upvote 0

Forum statistics

Threads
1,223,931
Messages
6,175,465
Members
452,646
Latest member
tudou

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