# Conditional formatting formulas odd even numbers

#### motilulla

##### Well-known Member
Hello,

From data column B5:F13 I want Conditional formatting formulas odd even numbers like this is it possible

Odds between 1 to 23 fonts White highlight colour Red

Odds between 25 to 49 fonts White highlight colour Magenta

Evens between 2 to 24 fonts White highlight colour Green

Evens between 25 to 50 fonts White highlight colour Blue

 * A B C D E F G H 1 2 3 4 5 9 13 21 29 35 6 2 3 13 17 21 7 2 10 16 42 50 8 16 21 27 30 32 9 7 32 39 40 45 10 16 28 32 44 48 11 12 34 37 38 42 12 18 23 37 41 42 13 2 10 18 34 35 14 4 10 27 38 40 15 16 17 18

Thank you all.

I am using Excel 2000

Regards,
Moti

#### Attachments

• Conditional formatting formulas odd even numbers.png
13.6 KB · Views: 6

### Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

#### Fluff

##### MrExcel MVP, Moderator
Would a macro be ok?
VBA Code:
``````Sub motilulla()
Dim Cl As Range
For Each Cl In Range("B5:F14")
Select Case True
Case Cl.Value Mod 2 = 1 And Cl.Value < 24
Cl.Interior.Color = vbRed
Case Cl.Value Mod 2 = 1 And Cl.Value > 23
Cl.Interior.Color = vbMagenta
Case Cl.Value Mod 2 = 0 And Cl.Value < 25
Cl.Interior.Color = rgbDarkGreen
Case Cl.Value Mod 2 = 0 And Cl.Value > 24
Cl.Interior.Color = vbBlue
End Select
Cl.Font.Color = vbWhite
Next Cl
End Sub``````

##### Well-known Member
Select Range From B5 to Last Go to Conditional Formating, Manage Rule, New Rule, Use a formula And Type This For Condition 1 to 4 And Select Colors That you want:
Odds between 1 to 23 fonts White highlight colour Red
Excel Formula:
``=AND(B5>0,B5<24,MOD(B5,2)=1)``
Odds between 25 to 49 fonts White highlight colour Magenta
Excel Formula:
``=AND(B5>24,B5<50,MOD(B5,2)=1)``
Evens between 2 to 24 fonts White highlight colour Green
Excel Formula:
``=AND(B5>0,B5<24,MOD(B5,2)=0)``
Evens between 25 to 50 fonts White highlight colour Blue
Excel Formula:
``=AND(B5>25,B5<51,MOD(B5,2)=0)``

#### Fluff

##### MrExcel MVP, Moderator
Unfortunately your suggestion wont work as the OP is using Xl2000, which is limited to 3 conditions.

#### motilulla

##### Well-known Member
Would a macro be ok?
VBA Code:
``````Sub motilulla()
Dim Cl As Range
For Each Cl In Range("B5:F14")
Select Case True
Case Cl.Value Mod 2 = 1 And Cl.Value < 24
Cl.Interior.Color = vbRed
Case Cl.Value Mod 2 = 1 And Cl.Value > 23
Cl.Interior.Color = vbMagenta
Case Cl.Value Mod 2 = 0 And Cl.Value < 25
Cl.Interior.Color = rgbDarkGreen
Case Cl.Value Mod 2 = 0 And Cl.Value > 24
Cl.Interior.Color = vbBlue
End Select
Cl.Font.Color = vbWhite
Next Cl
End Sub``````

Kind Regards
Moti

#### Fluff

##### MrExcel MVP, Moderator
Glad we could help & thanks for the feedback.

Replies
2
Views
229
Replies
7
Views
124
Replies
8
Views
166
Replies
5
Views
81
Replies
4
Views
79

1,127,318
Messages
5,623,974
Members
416,002
Latest member
Neshx

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

### Which adblocker are you using?

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