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

ARTMATHSHISTORY
NAME 1CLASS C15/07/2018
NAME 2CLASS A03/03/201826/01/2018
NAME 3CLASS C
NAME 4CLASS B28/02/201816/05/2018
NAME 5CLASS B04/12/2018
NAME 6CLASS A22/08/2018
NAME 7CLASS C14/11/201817/06/201804/10/2018
NAME 8CLASS A23/08/2018
NAME 9CLASS A
NAME 10CLASS A16/10/2018

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>


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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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,215,101
Messages
6,123,094
Members
449,095
Latest member
gwguy

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