You are on page 1of 5

Need help with a formula.

Want to sum the total of a range of cells, then if it is less then a


specific number the value should be "Fail", if greater then that number then
value should be "Pass"
I've used the And function True or False results. But they want the value
in the cells to say either Pass or Fail.
current formula: =AND(SUM(J8:R8)>0,SUM(J8:R8)<8)
Thanks
Formula help - Sum results Pass or Fail
Ron Coderre posted on Tuesday, March 04, 2008 3:02 PM
Try this:
=IF(SUM(J8:R8)<=8,"Fail","Pass")
Perhaps this?
=IF(COUNT(J8:R8),IF(SUM(J8:R8)<=8,"Fail","Pass"),"no data")
For a blank look.
=IF(COUNT(J8:R8),IF(SUM(J8:R8)<=8,"Fail","Pass"),"")
Assumes the "Fail", "Pass" formulas are in column A
To count the occurences of Pass or Fail
=COUNTIF(A:A,"Fail")
=COUNTIF(A:A,"Pass")

Capturing "text" instead of the formula


Bishop posted on Thursday, February 04, 2010 12:04 PM
I have the following code snippet:
Pass = 0
Fail = 0
For i = 9 To (ZeroRow - 3) Step 8
If Cells(i, "H").Value = Pass Then
Pass = Pass + 1
Else
Fail = Fail + 1
End If
Next
The cells I am referring to actually have formulas in them but when you look
at the worksheet the cells have either "Pass" or "Fail" in them. That's what
I am trying to capture. But when I run this code it does not see "Pass" in any
of the cells so all of them in the for loop get assigned to Fail. I have tried
putting the word Pass in quotes:
If Cells(i, "H").Value = "Pass" Then
Try this
Dim Pass As Long, i As Long
Dim Fail As Long, ZeroRow As Long
Pass = 0
Fail = 0
For i = 9 To (ZeroRow - 3) Step 8
If UCase(Cells(i, "H").Value) = "PASS" Then
Pass = Pass + 1
Else
Fail = Fail + 1
End If
Next

Formula - Exam Marksheet


Zainuddin Zakaria posted on Sunday, September 24, 2006 11:23 AM
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
One way:
=IF(OR((ISNUMBER(SEARCH("e",E7&G7&I7&K7))),(M7&O7&Q7="eee"),(S7&U7="ee")),
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: "".
=if(e7&g7&i7&k7&m7&o7&q7&s7&u7="","no entries", that long formula
Dave Peterson posted on Monday, September 25, 2006 8:03 AM
=if(e7&g7&i7&k7&m7&o7&q7&s7&u7="","no entries", that long formula here)
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"))
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
Possible Glitches
* If you use "70", instead of "70%", the passing grade will be calculated as
7000%
* If your numbers are not formatted as percentages, then the formula should
be =IF(I2>=.7,"PASS","FAIL").
* If you see "True" or "False" in a cell, then your formula may be missing a
condition in the syntax.
* The formula could be rewritten as =IF(I2<70%,"FAIL","PASS")
Simple Letter Grades
When calculating letter grades, the formula used evaluates a series of nested IF
formulas. First it checks to see if the score is 90% or above. If yes, the cell
gets an "A", otherwise, it checks to see if the grade is above 80%. If the scor
e is not a "B", it sees if the score is 70% or above and so on.
Formula
* =IF(I2>=90%,"A",IF(I2>=80%,"B",IF(I2>=70%,"C",IF(I2>=60%,"D","F"))))
Tip: As you add conditions to a nested formula, first add a set of empty p
arentheses, then fill in the formula.
Adding the Plus and Minus
In theory, you could expand the nested formula above to include more steps for A
-, B+, B- and so forth. Unfortunately, Excel only allows "nested" levels, so the
formula must be split into two parts.
For this exercise, we assume the following grading scale
* A = 95 to 100%
* A- = 90 to 94.9%
* B+ = 88 to 89.9%
* B = 83 to 87.9%
* B- = 80 to 82.9%
* C+ = 75 to 79.9%
* C = 70 to 74.9%
* D = 60 to 69.9%
* F = 59.9% and below
1. Assuming the worksheet previously used, insert the following formula into
cell J2.
=IF(I2>=95%,"A",IF(I2>=90%,"A-",IF(I2>=88%,"B+",IF(I2>=83%,"B",IF(I2>=80%,
"B-","")))))
This formula calculates grades down to B-. If the score is not a B-, then
the cell is left blank ("").
2. In cell K2, fill in this formula:
=IF(J2<>"",J2,IF(I2>=75%,"C+",IF(I2>=70%,"C",IF(I2>=60%,"D","F"))))
This formulas checks to see if there is a score in Column J (J2<>""). If t
here is a score, it copies the value in cell J2; otherwise it calculates grades
for C-F.
Here is a copy of the mock spreadsheet showing the results of both formulas.
Mock Student Spreadsheet with Letter Grade Results
A H I J K
1 Name Totals Percent Intermediate Final Letter Grade
2 Picard, J. 112 93.3% A- A-
3 Riker, W. 106 88.3% B+ B+
4 Troi, D. 117 97.5% A A
5 Zellig,W. 83 69.2% D
Excel: "Pass" / "Fail" in a column and "Fail" in red
There is a pivot table spreadsheet on the openSTA site which allows you to work
with timers. I wanted to compare that with a required result and then place "Pas
s" or "Fail" in the column depending on the result and then have "Fail" in red t
o highlight it.
You could of course use VBA but that requires a bit of programming skill.
The fist part is easy - just use the formula:
=IF(H1>K1,"Fail","Pass")
where H1 is the openSTA timer result and K1 is the required result.
The second part is done via selecting the "Pass" / "Fail" column and then right-
click / Format / Conditional Formatting.
The condition is "Cell value is equal to "Fail"", then click on the "Format" but
ton and select the red colour.
MS Excel "IF" formula - how to pass range (B2:G2) of arguments?
=IF(B2<50,"fail","pass") This is working fine. but how to make the following wor
k fine too. =IF(B2:D2<50,"fail","pass"). I want to check each and every value fr
om B2 to G2 for the same condition. when i try this i am getting some error like
this - #VALUE!. please help me out. Thanks in advance.
MS Excel "IF" formula - how to pass range (B2:G2) of arguments?
=IF(B2<50,"fail","pass") This is working fine. but how to make the following wor
k fine too. =IF(B2:D2<50,"fail","pass"). I want to check each and every value fr
om B2 to G2 for the same condition. when i try this i am getting some error like
this - #VALUE!. please help me out. Thanks in advance.
=IF(A1>=75,"Pass","Fail")
=IF(A1>=75,"Pass","Fail")
=IF(a1>=75 then B1 ....
thats where I have the problem..
For the nbext instance, I need to clear A1, put in another score, and have B1 (o
r c1, or d1, whichever is the case) keep a running tally of the number
of entries..

You might also like