Having trouble with a long Nested IF Statement - HELP!

Mettaya1

New Member
Joined
Oct 8, 2013
Messages
20
F

Original Score
G

Rating
264
18
6

<colgroup><col style="mso-width-source:userset;mso-width-alt:4022; width:83pt" span="2" width="110"> </colgroup><tbody>
</tbody>

I have created a nested IF statement to average out the original scores to the table below
Original Score
Rating
010
1-59
6-108
11-157
16-206
21-255
26-304
31-353
36-402
41-501
51+0

<colgroup><col><col span="2"></colgroup><tbody>
</tbody>

=IF(F3=0,10,IF(F3="", "",IF(AND(F3>=1,F3<=5),9,IF(AND(F3>=6,F3<=10),8,IF(AND(F3>=11,F3<=15),7,IF(AND(F3>=16,F3<=20),6,IF(AND(F3>=21,F3<=25),5,IF(AND(F3>=26,F3<=30),4,IF(AND(F3>=31,F3<=35),3,IF(AND(F3>=36,F3<=40),2,IF(AND(F3>=41,F3<=50),1,IF(AND(F3>50,F3<=1500),0))))))))))))

It works fine except that if there is a blank cell in F I get a rating of 10. I just want it to give a blank if the original score was blank instead of 10.

Any help would be appreciated.:confused:

Regards Mettraya1
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
If you change your data structure a bit, you can use a simple VLOOKUP.

AB
1Orig. ScoreRating
2010
319
468
5117
6166
7215
8264
9313
10362
11411
12510

<tbody>
</tbody>

FG
1Orig. ScoreRating
2264
3186

<tbody>
</tbody>

In G2 (and fill down): =VLOOKUP(F2,$A$2:$B$12,2)
 
Upvote 0
If you like, you can also add a column explaining the ranges (and if you like hide column A). For example:

ABC
1Orig. ScoreRangeRating
20010
311 to 69
466 to 118
51111 to 167
61616 to 216
72121 to 265
82626 to 314
93131 to 363
103636 to 412
114141 to 511
125151+0

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>

This formula in cell B2 and fill down: =IF(A3<>"",IF(ISNUMBER(A1),A2&" to "&A3,A2),A2&"+")
 
Upvote 0
I'd definitely go with bschwartz sugestion, but if you can't for some reason, try

Code:
=IF(F3="","",IF(F3=0,10,IF(F3<=5,9,IF(F3<=10,8,IF(F3<=15,7,IF(F3<=20,6,IF(F3<=25,5,IF(F3<=30,4,IF(F3<=35,3,IF(F3<=40,2,IF(F3<=50,1,IF(F3<=1500,0,""))))))))))))
 
Upvote 0
If you like, you can also add a column explaining the ranges (and if you like hide column A). For example:

ABC
1Orig. ScoreRangeRating
20010
311 to 69
466 to 118
51111 to 167
61616 to 216
72121 to 265
82626 to 314
93131 to 363
103636 to 412
114141 to 511
125151+0

<tbody>
</tbody>

This formula in cell B2 and fill down: =IF(A3<>"",IF(ISNUMBER(A1),A2&" to "&A3,A2),A2&"+")

Tried this suggestion and got the following

A
B
C
D
E
F
G
Original Score
CoPTTM Score
RatingCoPTTM Site Condition RatingCoPTTM ScoreRating
0
010High
2626 to 31
=VLOOKUP(F2,$A$2:$B$12,2)
11 to 69 1816 to 21
66 to 118
1111 to 167Acceptable
1616 to 216
2121 to 265
2626 to 314Needs Improvement
3131 to 36
3
3636 to 412
4141 to 511
5151+0Dangerous
Average#DIV/0!

<colgroup><col><col span="2"><col><col><col span="2"></colgroup><tbody>
</tbody>

Not sure why its not working. Put the function in the cell to the right:confused:
 
Upvote 0
Sorry, when I made the second suggestion, I should have updated the formula.

Use this: =VLOOKUP(G2,$A$2:$C$12,3)
 
Upvote 0
Another way (with your table):

Layout

Table
Original Score
Rating
0
10
26
4
1-5
9
18
6
6-10
8
11-15
7
51
0
16-20
6
35
3
21-25
5
39
2
26-30
4
50
1
31-35
3
0
10
36-40
2
3
9
41-50
1
8
8
51+
0
12
7
******
******
**
**
**
*************
*********

<tbody>
</tbody>


Formula

Code:
G2-> =IF($F2="","",LOOKUP($F2,--LEFT(SUBSTITUTE($A$2:$A$12,"-"," "),2),$B$2:$B$12))

Markmzz
 
Upvote 0
This appears to work well.

However am using conditional formatting in the G Column as follows
Rating of 10 -8 = Green
Rating of 7-5 = Yellow
Rating of 4-1 = Orange
Rating of 0 = Red

Your calculation formats the blank cells as Red, which is unfortunate. Otherwise appears to work well.
bschwartz just wouldn't work correctly for some reason but the B2 Range function was great.
 
Upvote 0
Why don't you try adding another conditional formatting rule (on the top of the list), that applies no formatting if
Code:
=G2=""
?
 
Upvote 0
I found a simple error in my condition statement. If you put condition as =0 or course it will also include blank cells.... dah.
But thanks bschwartz for your post... it made me look and see my mistake.
 
Upvote 0

Forum statistics

Threads
1,215,274
Messages
6,123,998
Members
449,137
Latest member
abdahsankhan

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