Another Countif Query

Fazila

Board Regular
Joined
Nov 19, 2014
Messages
163
Hello

I have a table similar to the one below:

English TeacherEnglish Teacher TargetEnglish Teacher AssessmentMaths TeacherMaths Teacher TargetMaths Teacher AssessmentScience TeacherScience Teacher TargetScience Teacher Assessment
abb-eddiss+
bdbfsd+jmm-
csb+gms-kbb
dmd-hbs+ldb+

<tbody>
</tbody>

I need to count the number of bs, ds, s' and ms in all the columns headed with ...Teacher Assessment.

The formula I have tried to use so far is =SUM(COUNTIF(INDEX(RawData,0,MATCH("*teacher assessment*",RawDataHeadings,0)),{"b-";"s1";"s2";"s3";"b-1";"b-2";"b-3"})) (the bit in bold highlights the many variations I need to count but only for this column).

For the other columns it will be simply B, B+, D- etch.

The result it is returning is 2 - the result should be well over 200.

Any ideas as to where I am going wrong?

Thanks
 
I take it back Aladin's formula did work only problem is it doesn't work where the value has + or -. I have added the ~symbol before the + and - but still no luck any idea how I can get around that?

Thanks again
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
What does doesnt work mean? What is the formula you use and what doesnt work about it?
 
Upvote 0
Thanks Steve I appreciate your time with this.

The formula works where I only have to count the number of Bs entered, however, for the column where I have to count "B-" or "B+" it is returning 0. I'm assuming this has to do with the fact that there is a "-" and a "+".

How can I make the formula count the values "B-" and "B+" as well?
 
Upvote 0
The original formula aladin provided just counts "B", "B-" or "B+" because it counts anything that starts with "B". Do you just want to count "B-" but ignore "B"?
 
Upvote 0
Yep, basically I need to populate this table

NORB-,S1,S2,S3,B-1,B-2,B-3BB+D-DD+S-SS+
SummaryAll Pupils296Count the number of the above values occur in columns with heading Teacher AssessmentCount the number of the above values occur in columns with heading Teacher AssessmentCount the number of the above values occur in columns with heading Teacher Assessment

<tbody>
</tbody>


So for the first column I will need to count B-, S1 etc. For the second column I will need to count the Bs, for the third the B+' etc.

I will also need to count the number of 1s where the column headings contain the word "Progress" and again the formula is turning a 0 value I'm assuming because it is a numerical value rather than text.

Hope the above make sense and again thanks for your time :)
 
Last edited:
Upvote 0
See if this works:

=SUM(IF(ISNUMBER(SEARCH("Teacher Assessment",A1:I1)),IF(ISNUMBER(MATCH(LEFT(A2:I5,2),{"b-","s1","s2","s3"},0)),1)))

Notice the difference in the LEFT formula.
 
Upvote 0
See if this works:

=SUM(IF(ISNUMBER(SEARCH("Teacher Assessment",A1:I1)),IF(ISNUMBER(MATCH(LEFT(A2:I5,2),{"b-","s1","s2","s3"},0)),1)))

Notice the difference in the LEFT formula.

Thank you so much Steve that worked!

And I know I'm taking advantage here a little but any ideas on how I can change the formula to count numbers? One of the columns I have to populate will be counting the number 1, then 2, then 3 etc.
 
Upvote 0
And is it possible to add other conditions to the formula i.e. if I want to count the number of students who are male and have got B- etc?
 
Upvote 0
=SUM(IF(ISNUMBER(SEARCH("Teacher Assessment",A1:I1)),IF(ISNUMBER(MATCH(A2:I5,{1,2,3,4},0)),1)))

You can add other conditions but it depends on the data.
 
Upvote 0
=SUM(IF(ISNUMBER(SEARCH("Teacher Assessment",A1:I1)),IF(ISNUMBER(MATCH(A2:I5,{1,2,3,4},0)),1)))

You can add other conditions but it depends on the data.

Thanks Steve you are an absolute genius.

The other conditions would be letters so I would need to calculate the number of males who meet the above criteria, then females, students who are gifted and talented or SEN etc

so it would be count if named range gender = M and teacher assessment columns equals B
 
Upvote 0

Forum statistics

Threads
1,216,090
Messages
6,128,765
Members
449,467
Latest member
sdafasfasdf

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