MATHS

NAME OF THE STUDENT GENDER Marks Obtained out of 100 Grade

N.Yamuna F 46 92 A1

R.Kiruthika F 50 100 A1

R.Sundharajan M 41 82 A2

M.Sakthivel M 41 82 A2

V.Prasanna M 45 90 A2

S.Annapoorani F Ab Ab Ab

P.Vigneswaran M Ab Ab Ab

T.Muruganandam M Ab Ab Ab

R.Jeyasurya F 40 80 B1

R.Thamizharasi F 38 76 B1

K.Madhumitha F 36 72 B1

P.Tamil Azhaki F 37 74 B1

L.Jamuna F 39 78 B1

P.Sakthivel M 40 80 B1

N.Dhanasekaran M 37 74 B1

M.Dhamodharan M 39 78 B1

M.Vemburaj M 38 76 B1

S.Muralidharan M 39 78 B1

S.Buvaneswari F 33 66 B2

A.Indhumathi F 31 62 B2

M.Rathika F 35 70 B2

P.Mahendhiran M 34 68 B2

R.Yogesh M 35 70 B2

L.Karthi M 33 66 B2

T.Krishnagandhi F 28 56 C1

S.Dhayalan M 29 58 C1

S.Muthukumar M 30 60 C1

A.Nagarajan M 28 56 C1

R.Sankar M 26 52 C1

R.Vengadesan M 25 50 C2

S.Sakthivel M 25 50 C2

A.Santhoshkumar M 23 46 C2

R.Parthasarathi M 23 46 C2

Please click on the blue lineat the end of this post and read the instructions on how to post example data in this forum.Then repost your data so that we can see how it lines up.

In the meantime, you might want to look at the SUMIF and COUNTIF functions to see if they will help you get the results you are looking for.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Is your data split into colums? NAME GENDER Marks out of 100If so then this should be pretty straight forward, how will the calculation begin? do you want it to be a running calculation ie the numbers add up as you enter a new entry, or do you want a button that you can press to get the final value?

Here is a possible way of doing it, however the trigger for this is a button. Once you have filled in the entire sheet you press a button or manually run the code and it will calculate the figures for you.

Sub test() Dim Urange, LRange Dim BCell As Range Dim MaleGrades, FemaleGrades As Integer Set Urange = Sheet1.Range("B2") Set LRange = Sheet1.Range(Range("B" & Rows.Count).End(xlUp).Address) For Each BCell In Range(Urange, LRange) If BCell.Value = "M" Then MaleGrades = MaleGrades + BCell.Offset(0, 1).Value ElseIf BCell.Value = "F" Then FemaleGrades = FemaleGrades + BCell.Offset(0, 1).Value End If Next BCell MsgBox "Male Grades are: " & MaleGrades & vbCrLf _ & "Female Grade are: " & FemaleGrades End Sub

@AWTL: When I try your code, I get a Type Mismatch error as soon as the code tries to add

AbtoFemaleGrades.In addition, while the OP's subject line says "Count" the grades, (s)he may indeed want to sum to grades as you have done.

However, I'm curious as to why you only sum the grades from Column C and not the grades from Column D.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Ask Your Question

Weekly Poll

Do you think Google Fiber has a strong future?

Discuss in The Lounge

Poll History