Countif, but really complicated

robgoldstein

Board Regular
Joined
Oct 26, 2013
Messages
165
Office Version
  1. 2019
Platform
  1. Windows
I have a class list with the names of students in column B and columns C,D &E are 3 kids from the list in column B they can be matched with.

In Column J I have their group they have been put into. ( values 1-4)
How can I count how many kids who put them as a potential match C10:E50 are in their group?

So their name would have appear in the kid's list and that kid would have to be in their group. So if the kid(B10) is in group 1, we would have to see how many kids in group 1 also have the name in B10 in columns C,D or E

thanks so much for your help.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Is this what you want.

and xl2bb is an addin used to post excel data in this site you can download it (See Right side of the message box)

Book1
BCDEFGHIJK
1
2NameGroupCount
3ADHF12
4BDCA20
5CHFA31
6DABC11
7EHEA21
8FBHC31
9GHCD40
10HDEF11
11
12
13
Sheet2
Cell Formulas
RangeFormula
K3:K10K3=SUM(--ISNUMBER(MATCH(TRANSPOSE(C3:E3),IF($J$3:$J$10=J3,$B$3:$B$10),0)))
 
Upvote 0
This is a little different take:

Book2
ABCDEFGHIJKLMNO
1StudentChoice AChoice BChoice C# of requestors in their groupGroupGroup 4
2AlNaomiLilyRae01DebCalNaomiKen
3BabsDebPamDeb02HeidiKenQuinceAl
4CalGuyMarkJen03LilyGuyEdHeidi
5DebCalNaomiKen24PamFayDebMark
6EdTaliaKenOllie11TaliaMarkDebLily
7FayEdPamAl12
8GuySamQuinceDeb33
9HeidiKenQuinceAl14
10IdrisGuyBabsIdris11
11JenAlIdrisPam12Group 3
12KenJenGuyPam03CalGuyMarkJen
13LilyGuyEdHeidi14GuySamQuinceDeb
14MarkCalOllieFay01KenJenGuyPam
15NaomiJenFayEd02OllieHeidiDebAl
16OllieHeidiDebAl03SamFayIdrisGuy
17PamFayDebMark04
18QuinceKenKenEd01
19RaeTaliaDebLily02
20SamFayIdrisGuy13
21TaliaMarkDebLily04
22
Sheet2
Cell Formulas
RangeFormula
G2:G21G2=SUMPRODUCT(MMULT(--($C$2:$E$21=B2),{1;1;1})*($J$2:$J$21=J2))


Columns L:O and the highlighting is just an attempt to show my work, so to speak. It appears that CA_PUNIT and I had different interpretations of your request, which is why an example is so helpful.
 
Upvote 0
Hey all,
Here is the data. I only put info in the kids who are in the same group for simplicity. I want the number in the cell K10 to equal 3. But if their name was in other kids friends who are not in group 1 it would not count it.

Class Placement Excel Document.xlsx
ABCDEFGHIJK
9Current ClassSTUDENT NAMESexFriendsFriendsFriendsShould NotShould NotPertinent NotesAssigned Class (1-4)Friends
10JK101Alexander Weizmanm13
11JK104Annie Brass fAlexander WeizmanRuby Callaghan* Ari Tabesh10
12JK104Annie Klug*f20
13JK101Arbel MillerfTamar Regev*Tyler MitzAlexander Weizman10
14JK101Ari Tabeshm31
15JK101Aria Moynihanf40
16JK104Ariella Bodzin*f20
17JK104Avner Hana*m30
18JK104Brixton Steinfeld*mMax JacobsAlexander WeizmanMarlee Gorenstein*10
19JK101Celeste Poslunsf0
20JK104Daniel Zaulan-Garpenfeldtm0
JK Worksheet
 
Upvote 0
Is this what you want.

and xl2bb is an addin used to post excel data in this site you can download it (See Right side of the message box)

Book1
BCDEFGHIJK
1
2NameGroupCount
3ADHF12
4BDCA20
5CHFA31
6DABC11
7EHEA21
8FBHC31
9GHCD40
10HDEF11
11
12
13
Sheet2
Cell Formulas
RangeFormula
K3:K10K3=SUM(--ISNUMBER(MATCH(TRANSPOSE(C3:E3),IF($J$3:$J$10=J3,$B$3:$B$10),0)))
Thanks so much for this. But what I am seeing in your example is not what I am looking for. For row 3 the count would be 1 and the only row that would be counted is row 6 because they are in group 1 and they have A as a friend.
 
Upvote 0
This is a little different take:

Book2
ABCDEFGHIJKLMNO
1StudentChoice AChoice BChoice C# of requestors in their groupGroupGroup 4
2AlNaomiLilyRae01DebCalNaomiKen
3BabsDebPamDeb02HeidiKenQuinceAl
4CalGuyMarkJen03LilyGuyEdHeidi
5DebCalNaomiKen24PamFayDebMark
6EdTaliaKenOllie11TaliaMarkDebLily
7FayEdPamAl12
8GuySamQuinceDeb33
9HeidiKenQuinceAl14
10IdrisGuyBabsIdris11
11JenAlIdrisPam12Group 3
12KenJenGuyPam03CalGuyMarkJen
13LilyGuyEdHeidi14GuySamQuinceDeb
14MarkCalOllieFay01KenJenGuyPam
15NaomiJenFayEd02OllieHeidiDebAl
16OllieHeidiDebAl03SamFayIdrisGuy
17PamFayDebMark04
18QuinceKenKenEd01
19RaeTaliaDebLily02
20SamFayIdrisGuy13
21TaliaMarkDebLily04
22
Sheet2
Cell Formulas
RangeFormula
G2:G21G2=SUMPRODUCT(MMULT(--($C$2:$E$21=B2),{1;1;1})*($J$2:$J$21=J2))


Columns L:O and the highlighting is just an attempt to show my work, so to speak. It appears that CA_PUNIT and I had different interpretations of your request, which is why an example is so helpful.
Yes, this is what I am looking for. Thank you so much.
 
Upvote 0

Forum statistics

Threads
1,216,165
Messages
6,129,242
Members
449,496
Latest member
Patupaiarehe

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