Conditional formatting based on month as text

Closed
sh4dow - Nov 8, 2010 at 03:55 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Nov 15, 2010 at 08:37 PM
Hi,

I have a list of months in one column, and I want to format it so that if it is the current month, the cell is red; if the month is one month or more behind, it's grey, and if it's the following month, it's yellow.


I'd also like the month to be displayed as text, rather than in date format.

Is this possible?

I don't know enough about formulae to write, or understand them, so explanations for each section would be very helpful so I can tweak as needed!!

Many thanks!

EDIT:

=Q2=TEXT(TODAY(),"mmmm")
Ok so I found this formula for highlighting whichever month is todays date's month (so currently all November cells are highlighted)
I can't seem to edit this to format if the month is +1 of the current month (so December), or < the current month (so everything before November)
Related:

9 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Nov 11, 2010 at 09:19 PM
as I told you, you cannot type "November" in a cell and ask excel to recognize October as one month before November,. what you have to do is to enter dates and not texts
in my regional configuration I should enter dates as month/day/year
if so enter like this

in A1 enter 1/1/10
highlight some about 12 cells from A1 down
click edit-fill-series
in series window check "month" under data unit
make step value as 1 (it is already there)
click OK.
now the entry will be

if you are interested you can print out these instructions and follow.

1/1/2010
2/1/2010
3/1/2010
4/1/2010
5/1/2010
6/1/2010
7/1/2010
8/1/2010
9/1/2010
10/1/2010
11/1/2010
12/1/2010

keeping the highlight over these cells
click format menu, cells, custom
in the format cells window type mmmm
and click OK

the data will now be

January
February
March
April
May
June
July
August
September
October
November
December


now only excel will recognize arithmetic of dates


now select A1
click format-conditional formatting
under condition 1 click the triangle(or small arrow) and choose
the formula is
hit F2
in the right window type
=MONTH(A1)=MONTH(TODAY())
click format below this line and choose pattern(last item)
and choose the color red

now click "add" at the bottom
second condition 1 comes up
now repeat the action except the formula on the right window will be

=MONTH(A1)<MONTH(TODAY())
and choose pattern color grey
again click add
repeat except the formula is
=MONTH(A1)>MONTH(TODAY())
and choose pattern color as yellow

now click ok
again click ok

the color pattern may be changed if you want

now select A1 click edit-copy
select A1 to A12 and click edit-pastespecial-FORMAT
CLICK OK

sorry this is a cumbersome affair but you will learn how to do condition formatting. remember in excel 2003 and before you cannot have more than 3 conditions.
if the months go to the next year the formulas need some modification

of course instead of this you can have a macro. I am sure you are familiar with
macro . in that case post back

If I come up with some simpler solution I shall let you know
1