We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How do I format a background color with a cell formula?

garyrobbins
garyrobbins asked
on
Medium Priority
384 Views
Last Modified: 2012-05-11
I have a cell (A1) that displays the “Tab Name”.  The tab name is a date (for each day of the month), eg. 11-04-18.  

Each day of the week has a different color associated with it:
Mon – Yellow
Tue – Blue
Wed – Pink
Thur – Gold
Fri – Green

I want to program this cell with a formula to change background color based on the day of the week for that date.  Eg. 11-04-08 is background color Yellow; 11-04-19 is Blue.

First, can I do this with a cell formula, and then where do I start?

Would it be easier to program a background color for the actual tab?

What would you recommend?

Gary
Comment
Watch Question

A formula can not change the background colour of a cell.

You can use conditional formatting, however, as you are using 2003, you can only enter three conditions to change the background colour, not helpful when you need 5!

You will need to create a macro based on cell update for cell A1, when you enter the date, it will change the background colour based on the "Day" extracted from the date.
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
SiddharthRout,
Thank you.  You make this sound easy...  Could you help me out with a brief explanation of how this code works?

Gary
Sure Gary.

First download the workbook which I have attached in the above post and then run the macro Sample. Does it do what you want?

Sid

Author

Commented:
Great solution.  Now I need to get better at understanding VBA.

Gary
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.