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

squeakums

Well-known Member
Joined
May 15, 2007
Messages
823
Office Version
  1. 365
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.

Please help :)
 

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))
 
Upvote 0
Good question, apparently I am stuck on how to write this formula. Any suggestions?
 
Upvote 0
Best bet would be making some sort of function to do this.

Code:
colorcode(grade,other input)

If grade >= 0.9 Then

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..
 
Upvote 0
Why a UDF, why not just use LOOKUP?

=IF(ISNUMBER(D10),LOOKUP(D10,{0,3;0.8,2;0.9,1}),"")
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
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.
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