if/then statement to add 1, 2 or 3 based on conditional format

squeakums

Well-known Member
I am working on this formula and I need assistance. An if/then statement to add 1, 2 or 3 based on conditional formatting - for example if the format is Red then put a 3.

Or, perhaps set it up for a range if possible:

=IF(OR(D10="-"),"",IF(OR(D10=92%),1))

Instead of just 92% can I make it a range 90% - 92.% then 2 points.

Although, it would be a lot easier to set it up if D10 is equal to Orange then put point 1.

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
so why are you using OR when there is only one condition?
=IF(OR(D10="-"),"",IF(OR(D10=92%),1))

Good question, apparently I am stuck on how to write this formula. Any suggestions?

Best bet would be making some sort of function to do this.

Code:
``````colorcode(grade,other input)

colorcode = 1

ElseIf grade < 0.9 And <= 0.8 Then

colorcode = 2

ElseIf grade < 0.8 And <= 0.7 Then

colorcode = 3

End If

End Function``````

Hopefully this will put you on the right track..

Why a UDF, why not just use LOOKUP?

=IF(ISNUMBER(D10),LOOKUP(D10,{0,3;0.8,2;0.9,1}),"")

That might work - what is the

=IF(ISNUMBER(D10),LOOKUP(D10,{0,3;0.8,2;0.9,1}),"")

.80 .90..

The issue is the range is like 93.5 to 95.5 for yellow = 1 point

96 - 105 for green - no points (don't need to write anything for this)

if 110 or more - 3 points, or if less than 89% 3 points

If 90 - 93% - 2 points

What is the best way to write this? I would prefer to stick with a non-macro if possible.

Is there a way that I can setup like this?

=IF(D22=F126:F1125,1), IF (D22=A126:A375, 2), IF (D22=B126:B375, "")

So that it looks at each number in each range and if it equals to any of those then creates a 1, 2, etc.

Replies
2
Views
96
Replies
1
Views
163
Replies
3
Views
510
Replies
1
Views
283
Replies
5
Views
155

1,203,067
Messages
6,053,334
Members
444,654
Latest member
Rich Cohen

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.

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

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