If statement with grades

rwmill9716

Active Member
Joined
May 20, 2006
Messages
495
Office Version
  1. 2013
Platform
  1. Windows
I need an IF statement that keys off grades of C- to A+. Something like this: IF(B1>="C-",A1,""). I know that statement doesn't work, while using a series of OR statements does, but I wondered if there was something simpler than the OR statement approach which uses 9 substatements, e.g., OR(B1="C-",B1="C", etc).
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Something like this.


Excel 2013/2016
AB
1DataRemarks
210C-
Sheet10
Cell Formulas
RangeFormula
B2=IF(OR(A2<=10,A2<=15),"C-",IF(OR(A2<=20,A2<=25),"C",IF(OR(A2<=30,A2<=35),"B-",IF(OR(A2<=40, A2<=45),"B",IF(OR(A2<=50, A2<=55),"A-",IF(OR(A2<=60, A2<=100),"A+","-"))))))
 
Upvote 0
Thanks, Sam_D_Ben,

This is not exactly what I was looking for. Assume your col A had a list of names and Col B a list of grades. I want names in Col C that had a grade of C- or better. I know that I can do this with a series of OR statements (and I set it up that way), but I wondered if there was a simplier IF statement, like IF(B2>="C-",A2,"") for Cell C2.
 
Upvote 0
Maybe

Book1
ABC
1NameGrade
2Tom PearceATom Pearce
3Bill BrewerDPeter Gurney
4Jan StewerFDan'l Whiddon
5Peter GurneyC-Harry Hawke
6Peter DavyD+Tom Cobbley
7Dan'l WhiddonC+
8Harry HawkeA-
9Tom CobbleyB+
End
Cell Formulas
RangeFormula
C2=IFERROR(INDEX($A$2:$A$9,AGGREGATE(15,6,(ROW($A$2:$A$9)-ROW($A$2)+1)/($B$2:$B$9<="C+"),ROWS($1:1))),"")
 
Upvote 0
Have you tried filtering it? Just select column B, click the filter button, then check all the A, B, and C boxes.

If you want a formula, here are 2 options:

Excel 2012
ABCDEFG
NameGradePassersScore above:B-Grades
AmyAAmyBobF
BobB-BobEricaD-
ClaireC-ClaireFredD+
DanDEricaIreneD+
EricaA+FredKellyC-
FredB+HalC
GingerFIreneC+
HalC-KellyB-
IreneB+B
JackFB+
KellyA-A-
A
A+

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]8[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]10[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]11[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]12[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]13[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]14[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1


[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]C2[/TH]
[TD="align: left"]=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$2:$A$20)/(LEFT($B$2:$B$20)={"A","B","C"}),ROWS($C$2:$C2))),"")[/TD]
[/TR]
[TR]
[TH]D2[/TH]
[TD="align: left"]=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$2:$A$20)/(MATCH($B$2:$B$20,$G$2:$G$14,0)>=MATCH($E$1,$G$2:$G$14,0)),ROWS($C$2:$C2))),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



The first has the A, B, or C hardcoded in the formula (following +/- sign ignored). The second lets you put an arbitrary grade in E1, and selects the grades that are higher in the grade list in column G.
 
Last edited:
Upvote 0
Maybe

Book1
ABC
1NameGrade
2Tom PearceATom Pearce
3Bill BrewerDPeter Gurney
4Jan StewerFDan'l Whiddon
5Peter GurneyC-Harry Hawke
6Peter DavyD+Tom Cobbley
7Dan'l WhiddonC+
8Harry HawkeA-
9Tom CobbleyB+
End
Cell Formulas
RangeFormula
C2=IFERROR(INDEX($A$2:$A$9,AGGREGATE(15,6,(ROW($A$2:$A$9)-ROW($A$2)+1)/($B$2:$B$9<="C+"),ROWS($1:1))),"")

Assuming Fluff's layout, here is an array-entered** formula that you can use...

=IFERROR(INDEX(A:A,SMALL(IF(B$2:B$9<"D",ROW(B$2:B$9)),ROWS(C$1:C1))),"")

**Commit this formula using CTRL+SHIFT+ENTER and not just Enter by itself.
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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