MS Office Forum / Excel / New Users / September 2006
Formula - Exam Marksheet
|
|
Thread rating:  |
Zainuddin Zakaria - 24 Sep 2006 16:23 GMT 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.
Don Guillett - 24 Sep 2006 17:08 GMT You can use COUNTIF for the nested if's usind AND
 Signature Don Guillett SalesAid Software dguillett1@austin.rr.com
> Please help me with a formula for my marksheet. > [quoted text clipped - 9 lines] > > Thank you for your time. Zainuddin Zakaria - 24 Sep 2006 18:18 GMT Can u suggest the formula, Don Guillet? Thank you so much.
> You can use COUNTIF for the nested if's usind AND > [quoted text clipped - 11 lines] >> >> Thank you for your time. Dave Peterson - 24 Sep 2006 18:33 GMT One way:
=IF(OR((ISNUMBER(SEARCH("e",E7&G7&I7&K7))),(M7&O7&Q7="eee"),(S7&U7="ee")), "Failed","Passed")
> Please help me with a formula for my marksheet. > [quoted text clipped - 9 lines] > > Thank you for your time.
 Signature Dave Peterson
Zainuddin Zakaria - 25 Sep 2006 06:42 GMT 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.
> One way: > [quoted text clipped - 14 lines] >> >> Thank you for your time. Max - 25 Sep 2006 09:43 GMT 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: "".
 Signature Max Singapore http://savefile.com/projects/236895 xdemechanik ---
> 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. Dave Peterson - 25 Sep 2006 13:03 GMT =if(e7&g7&i7&k7&m7&o7&q7&s7&u7="","no entries", that long formula here)
> Thanks a lot, Dave. > But if I leave all the cells blank, the overall result shows the student [quoted text clipped - 25 lines] > > > > Dave Peterson
 Signature Dave Peterson
Don Guillett - 25 Sep 2006 13:12 GMT 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"))
 Signature Don Guillett SalesAid Software dguillett1@austin.rr.com
> Thanks a lot, Dave. > But if I leave all the cells blank, the overall result shows the student [quoted text clipped - 21 lines] >>> >>> Thank you for your time. bplumhoff@gmail.com - 26 Sep 2006 10:16 GMT 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" <s...@tm.net.my> '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
Zainuddin Zakaria - 27 Sep 2006 07:51 GMT 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
> Please help me with a formula for my marksheet. > [quoted text clipped - 9 lines] > > Thank you for your time.
|
|
|