Coloring Cells based on multiple values/other Cells that contain Dates

rhybeka

New Member
Joined
Mar 22, 2013
Messages
32
One of my managers asked me to do this for him, and I've been trying most of the day to wrap my brain around a 'simple' solution to this and coming up dry. I need to have the cells in column G color based on a value in themselves or in adjacent cell in column H.

I have three columns (F,G,H) all with dates in them. Column F is manually filled in, column G is calculated with a workday function
Code:
(=IFERROR(WORKDAY($F6,25,Holidays2016)," ")
to be 25 days later and column H is also manually filled in.
(F)
Date of Meeting
(G)
Report Due Date
(H)
Report Published
1/7
2/11
1/14
1/7
2/11
1/14
1/8
2/12
1/21
1/13
2/17

<tbody>
</tbody>

The background color needs to be in cell/column G but is also dependent upon the adjacent cell values in column H.

-if cell G is blank, than color clear/white

- if there is no date in column H and the date in column G is within 7 days, color it yellow

-if the date in cell G is today, make it red

I can't seem to figure out how to write a function that will allow conditional formatting to make this work. I was thinking maybe adding an extra column to do some of the calculation would be better but can't figure out how to do that and then have it color cell G.

I might be able to use the color function VBA and just code the macro to run on open so the user doesn't have to click a button or anything. Working through that thought process now.


Any input would be greatly appreciated. Thanks!

Beka
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
If you are familiar with CF, ignore the 1st 2 points
1. highlight the range you want to apply the conditional formatting to (say, G2:G100)
2. on the home tab, styles, select CF
3. select new rule, select use formula
4. enter =G2="".................Format Fill clear/white

Repeat 3 and 4 with =AND(H2="",G2+7<=X)...(put here what your criteria date is, I didn't see where you mentioned that?)
Format Fill YELLOW
New Rule =G2=TODAY().........format fill RED
 
Upvote 0
Thanks Ford! It seems to be getting closer but not quite there yet. as of what I have with the below, I have no colors in the G column. I must have something set incorrectly or don't understand CF as well as I thought I did!

I have the =TODAY function is in S2.
I have =S2-7 in the S3 cell

The dates start in F/G/H cell 6 and goes through cell 30

So if there is no date in the H cell, color G cells white/blank
Formula: =H6=""

If the date in column G is seven days or less from today's date, make it yellow
Formula: =AND(H6="",G6>=S3)

If the date in column G is today, make red
Formula: =G6=S2
 
Upvote 0
Yes, that would be correct. You dont need an extra cell for TODAY()-7, although it does no harm to have it

If the date in column G is seven days or less from today's date, make it yellow
Formula: =AND(H6="",G6>=S3)
If it is less than today-7, shouldnt that be =AND(H6="",G6<S3) ?
 
Upvote 0
Yes, that would be correct. You dont need an extra cell for TODAY()-7, although it does no harm to have it


If it is less than today-7, shouldnt that be =AND(H6="",G6<s3) ?[="" quote]



instead of =AND(H6="",G6>=S3) ? I don't think so. There's nothing to tell it to be seven days less? I tried it nevertheless and I still get nothing. I have a few dates I updated to make column G today and nothing is coloring - no red or yellow. So I'm going to take another stab at this.
</s3)>
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,048
Members
449,206
Latest member
Healthydogs

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