ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I apply conditional formatting to even or odd numbers? (https://www.excelbanter.com/excel-discussion-misc-queries/121830-how-do-i-apply-conditional-formatting-even-odd-numbers.html)

pashearer

How do I apply conditional formatting to even or odd numbers?
 
I'm trying to change the color of various cells that have the following
string 8056201-001, 8056202-001, 8056203-001, etc. I'd like change the even
numbers to blue text and the odd numbers to green.

Dave F

How do I apply conditional formatting to even or odd numbers?
 
Well XL doesn't consider numbers formatted in that manner to be numbers but
rather strings of text.

How do you consider one of these "numbers" to be even or odd? On the basis
of the last digit? The first digit?

If it's the last then you would do something like
=OR(Right(A1="1",1),...RIGHT(A1="9",1))))

Fill in the ... with 3, 5, and 7

If your determination of odd or even depends on the first character, then
replace RIGHT with LEFT in the above function.

Dave
--
Brevity is the soul of wit.


"pashearer" wrote:

I'm trying to change the color of various cells that have the following
string 8056201-001, 8056202-001, 8056203-001, etc. I'd like change the even
numbers to blue text and the odd numbers to green.



All times are GMT +1. The time now is 10:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com