Using counta and countif

Jowej

New Member
Joined
Jul 5, 2012
Messages
10
Hi, I have a spreadsheet and on one of the sheets named 'data' I have names (column C), areas (column E) and categories from row F1:P1. For easy reference I will call the areas 'class' and categories 'subjects'. It looks something like below

[TABLE="width: 387"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD]ART[/TD]
[TD]MATHS[/TD]
[TD]HISTORY[/TD]
[/TR]
[TR]
[TD]NAME 1[/TD]
[TD]CLASS C[/TD]
[TD]15/07/2018[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAME 2[/TD]
[TD]CLASS A[/TD]
[TD]03/03/2018[/TD]
[TD][/TD]
[TD]26/01/2018[/TD]
[/TR]
[TR]
[TD]NAME 3[/TD]
[TD]CLASS C[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAME 4[/TD]
[TD]CLASS B[/TD]
[TD]28/02/2018[/TD]
[TD]16/05/2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAME 5[/TD]
[TD]CLASS B[/TD]
[TD][/TD]
[TD]04/12/2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAME 6[/TD]
[TD]CLASS A[/TD]
[TD]22/08/2018[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAME 7[/TD]
[TD]CLASS C[/TD]
[TD]14/11/2018[/TD]
[TD]17/06/2018[/TD]
[TD]04/10/2018[/TD]
[/TR]
[TR]
[TD]NAME 8[/TD]
[TD]CLASS A[/TD]
[TD][/TD]
[TD]23/08/2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAME 9[/TD]
[TD]CLASS A[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAME 10[/TD]
[TD]CLASS A[/TD]
[TD][/TD]
[TD][/TD]
[TD]16/10/2018[/TD]
[/TR]
</tbody>[/TABLE]


In another sheet I am looking up data from this sheet. In cell D2 I have a validation looking at the all the subjects in row 1 from F:P. In C4 I have 'Class A', in D4 'Class B' etc. In C5 I have a basic counta formula counting the total numbers for Class A etc . The formula I need is for cell C6 which will be look at cell C4 (Class A) and cell D2 (the subject) against my data and return the number for that, in this case if we chose Class A and Art it would return 2. The data would change as I changed my subject.

In addition to this I also want to list the names of anyone in Class A and Art that does not have a date (this would be in cell C12. Class B would be in D12. In this instance it would bring off Name 2, Name 8 and Name 10 and again that would change as cell D2 (subject) changed

I hope this makes sense and any help is appreciated. I have tried countif by using another sheet and converting the dates to numbers and also sum product
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi Jowej,

I converted your original table into a data map on another sheet, with the output on Sheet 3. Some of the formulas you will need to drag across first.


Book1
CDEFGH
1StudentsAreasARTMATHSHISTORY
2NAME 1CLASS C15-07-18
3NAME 2CLASS A03-03-1826-01-18
4NAME 3CLASS C
5NAME 4CLASS B28-02-1816-05-18
6NAME 5CLASS B04-12-18
7NAME 6CLASS A22-08-18
8NAME 7CLASS C14-11-1817-06-1804-10-18
9NAME 8CLASS A23-08-18
10NAME 9CLASS A
11NAME 10CLASS A16-10-18
Data
<table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr>


Book1
ABCDE
1ARTMATHSHISTORY
2345
3NAME 1CLASS CART45
4NAME 2CLASS AART4HISTORY
5NAME 3CLASS C345
6NAME 4CLASS BARTMATHS5
7NAME 5CLASS B3MATHS5
8NAME 6CLASS AART45
9NAME 7CLASS CARTMATHSHISTORY
10NAME 8CLASS A3MATHS5
11NAME 9CLASS A345
12NAME 10CLASS A34HISTORY
Map
Cell Formulas
RangeFormula
C2=COLUMN()
C3=IF(ISNUMBER(Data!F2),C$1,COLUMN())
A3=Data!C2
B3=Data!E2



Book1
BCDE
1SUBJECTArray
2ART3
3
4Class AClass BClass C
5Counts523
6vs Subject212
7
8
9
10
11
12Non-EnrolledNAME 8NAME 5NAME 3
13NAME 9
14NAME 10
Sheet3
Cell Formulas
RangeFormula
E2=INDEX(Map!$C$2:$E$2,MATCH(Sheet3!$D$2,Map!$C$1:$E$1,0))
C6=SUMPRODUCT((Map!$C$3:$E$12=Sheet3!$D$2)*(Map!$B$3:$B$12=Sheet3!C$4))
C12{=IFERROR(INDEX(Map!$A$3:$A$12,SMALL(IF(Map!$B$3:$B$12=Sheet3!C$4,IF(Map!$C$3:$E$12=Sheet3!$E$2,ROW(Map!C$3:C$12)-ROW(Map!C$3)+1)),ROWS(Sheet3!C$12:C12))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

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