Formula - Exam Marksheet

  • Thread starter Thread starter Zainuddin Zakaria
  • Start date Start date
Z

Zainuddin Zakaria

Please help me with a formula for my marksheet.

The exam grading is A, B, C, D and E. E is a failure

To pass the overall exam, a student must :-

Must NOT FAIL in any 4 subjects from columns E7, G7, I7 and K7
and MUST PASS ONE subject from column M7, O7, or Q7
and MUST PASS ONE subject from column S7, or U7

What is the best formula for this?

Thank you for your time.
 
One way:

=IF(OR((ISNUMBER(SEARCH("e",E7&G7&I7&K7))),(M7&O7&Q7="eee"),(S7&U7="ee")),
"Failed","Passed")
 
Thanks a lot, Dave.
But if I leave all the cells blank, the overall result shows the student
'Passed' the exam.
This shouldn't be.
How to solve this? Any other formula, Dave.
Thank you again.
 
Just throwing in some thoughts here in the interim ..
(do hang around for Dave's response)

Perhaps you could try this in say V7:
=IF(OR(LEN(E7&G7&I7&K7)<4,LEN(M7&O7&Q7)<3,LEN(S7&U7)<2),"",IF(AND(SUMPRODUCT(NOT(ISNUMBER(SEARCH("e",E7&G7&I7&K7)))*(LEN(E7&G7&I7&K7)=4))>0,SUMPRODUCT(--(M7={"a","b","c","d"})+--(O7={"a","b","c","d"})+--(Q7={"a","b","c","d"}))>0,SUMPRODUCT(--(S7={"a","b","c","d"})+--(U7={"a","b","c","d"}))>0),"Passed","Failed"))

Above presumes all 9 grade cells must be completed, otherwise it'll just
return blank: "".
 
I think Dave gave you a great formula. If b7 is blank it is also. Or, you
could make if x7="" but it really doesn't matter because if you put
something in B7 it is assumed you will fill in the blanks. Tell him Thanks.

=IF(B7="","",IF(OR((ISNUMBER(SEARCH("E",E7&G7&I7&K7))),(M7&O7&Q7="EEE"),(S7&U7="EE")),"Failed","Passed"))
--
Don Guillett
SalesAid Software
(e-mail address removed)
Zainuddin Zakaria said:
Thanks a lot, Dave.
But if I leave all the cells blank, the overall result shows the student
'Passed' the exam.
This shouldn't be.
How to solve this? Any other formula, Dave.
Thank you again.
 
Hello,

I suggest to use:

=pass_or_fail("MUSTNOTFAIL",E1,G1,I1,K1,"MUSTPASS",M1,O1,Q1,"MUSTPASS",S1,U1)

You will have to put the code shown below into a VBA module (push ALT +
F9, insert a module and paste the code shown below):

Option Explicit
Const spasschar As String = "ABCD"
Const sfailchar As String = "E"
Function pass_or_fail(ParamArray v() As Variant) As Boolean
'Call with
=pass_or_fail("MUSTNOTFAIL",E1,G1,I1,K1,"MUSTPASS",M1,O1,Q1,"MUSTPASS",S1,U1)
'to solve newsgroup question shown below.
'From: Zainuddin Zakaria - view profile
'Date: Sun, Sep 24 2006 4:23 pm
'Email: "Zainuddin Zakaria" <[email protected]>
'Groups: microsoft.public.Excel
'
'
'Please help me with a formula for my marksheet.
'
'The exam grading is A, B, C, D and E. E is a failure
'
'
'To pass the overall exam, a student must :-
'
'
'Must NOT FAIL in any 4 subjects from columns E7, G7, I7 and K7
'and MUST PASS ONE subject from column M7, O7, or Q7
'and MUST PASS ONE subject from column S7, or U7
'
'
'What is the best formula for this?
Dim i As Long, j As Long
Dim bpass As Boolean
Dim r As Range
Dim vi As Variant
Dim s As String

s = "Error"
For Each vi In v
Select Case TypeName(vi)
Case "String"
If s = "MUSTPASS" And Not bpass Then
pass_or_fail = False
Exit Function
End If
s = vi
If s <> "MUSTPASS" And s <> "MUSTNOTFAIL" Then
pass_or_fail = CVErr(xlErrValue)
Exit Function
End If
bpass = False
Case "Range"
If s = "MUSTNOTFAIL" Then
For Each r In vi
If InStr(sfailchar, r) > 0 And Len(r) > 0 Then
pass_or_fail = False
Exit Function
End If
Next r
ElseIf s = "MUSTPASS" Then
For Each r In vi
If InStr(spasschar, r) > 0 And Len(r) > 0 Then
bpass = True
End If
Next r
Else
pass_or_fail = CVErr(xlErrValue)
Exit Function
End If
Case Else
pass_or_fail = CVErr(xlErrRef)
Exit Function
End Select
Next vi
If s = "MUSTPASS" And Not bpass Then
pass_or_fail = False
Exit Function
End If
pass_or_fail = True

End Function
 
Dearest all,

Thank you so much for coming out with great suggestions.
You guys are really experts in this.
My problem is solved,

Thanks, Don Guilet, Dave Peterson, Max and Bplumhoff.


Zainuddin Zakaria
 
Back
Top