+ Reply to Thread
Results 1 to 8 of 8

Conditional formatting to change cell colour based on date in another cell

  1. #1
    Registered User
    Join Date
    10-07-2019
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    22

    Conditional formatting to change cell colour based on date in another cell

    Hi all.

    I have attached a sample spreadsheet showing what I currently have on the first line and what I want to achieve on the second.

    The spreadsheet is a service schedule. When a date is entered in the first box - "First service in week commencing" - it automatically works out the dates of upcoming services. The conditional formatting I have applied means that when the scheduled date gets within 14 days, the "Next service Due in week commencing" cell will change colour; first to yellow, and when the date is 7 days away,it changes to amber.

    When a date is entered in the "Date booked in" column, it has the same behaviour as the previous cell, acting as a warning that it is due.

    The next column - "Date serviced" - has a reaction to the date entered. If the date is within 7 days of the due date, it will turn green to show compliance with not just my company's policy, but with the law as well.

    What I would like to do is have all 3 cells turn green if the date in the "Date Serviced" is within 7 days of the "Next service due in the week commencing" so D9,D10 & D11 as shown on the row below.

    I have tried lots of different things, had it working once and accidentally deleted the working formula and haven't been able to replicate the desired result no matter what I try (because I basically don't know what I'm doing!)

    Any help would be greatly appreciated. I bet this is such a simple fix but just too dumb to work it out and google is not helping!!!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,849

    Re: Conditional formatting to change cell colour based on date in another cell

    While having D9:E14 selected, go to conditional formatting and add this rule:
    =AND($F9>=$D9,$F9<=$D9+7)
    This should get you close anyway.

  3. #3
    Registered User
    Join Date
    10-07-2019
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    22

    Re: Conditional formatting to change cell colour based on date in another cell

    Thanks Greg. It's definitely going to be along those lines. I was trying loads of different things before - all derived from google - I know it's something to do with the order as well, but not working yet. I wont be deleting this formula either as I just know it's close!

  4. #4
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,849

    Re: Conditional formatting to change cell colour based on date in another cell

    You didn't say what was wrong with it. If it was that column F wasn't being filled, you would just include that column in the "Applies to" of conditional formatting. I've attached a file. Let me know exactly what isn't working correctly. BTW, I only did it for columns D,E, and F. I figured you could copy it to the rest of the columns if it worked for you.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-07-2019
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    22

    Re: Conditional formatting to change cell colour based on date in another cell

    Hi Greg. Sorry about that. I have already set the conditional formatting to turn green when the date is withing 7 days of the due date. That was easy. What I am finding hard to do is to get all 3 cells to turn green when the cell in the third column (5th, depending on your point of view!) is filled with the date being within 7 days of the due date. It's purely for cosmetic purpose as it would look alot nicer and more professional.

    So.... end result is this.....

    a date for "next service due in week commencing" has a date entered automatically from the initial date.

    I then populate the next column - "date booked in" with the date that the service is due.

    The next column shows the actual date of the vehicle service, ideally the same as the previous column.


    When I enter the date in the column for "date serviced", I would like that cell and the 2 preceding cells to turn green.

    Additionally, if I delete the date in the "date serviced" column, I want all 3 cells to revert back to the colour they were previously.

    The formula i have used so far dont accomplish this and that's the problem.

  6. #6
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,849

    Re: Conditional formatting to change cell colour based on date in another cell

    Did you look at the file I attached? It does what you're asking, as best I can tell. Give me the scenario where it doesn't work so I can look at.

  7. #7
    Registered User
    Join Date
    10-07-2019
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    22

    Re: Conditional formatting to change cell colour based on date in another cell

    Greg.....I think my laptop was having a brainfart when I first downloaded that. It works perfectly and all is sweet in the world of me thanks to you knowing what to do. Can't thank you enough for the help you've given. I honestly knew it would be a simple formula but just couldn't see the wood for the trees!!!!!!!

  8. #8
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,849

    Re: Conditional formatting to change cell colour based on date in another cell

    You're welcome - glad it worked for you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Conditional Formatting - Cell colour based on date
    By HiYoJoe in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-08-2017, 05:07 AM
  2. Replies: 6
    Last Post: 04-11-2016, 09:48 AM
  3. Replies: 2
    Last Post: 02-22-2015, 11:52 AM
  4. Replies: 1
    Last Post: 11-21-2013, 01:16 PM
  5. [SOLVED] Change cell colour based on text being present - conditional formatting?
    By rob-the-randy-rascal in forum Excel General
    Replies: 8
    Last Post: 08-01-2013, 11:24 AM
  6. [SOLVED] Conditional Formatting to Change Cell Colour Based on Date
    By Kym2101 in forum Excel General
    Replies: 5
    Last Post: 05-01-2012, 11:41 PM
  7. conditional formatting to change colour of cell based on formula result
    By gideong in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-15-2009, 09:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1