+ Reply to Thread
Results 1 to 9 of 9

If cell has date within certain timeframe, change color?

  1. #1
    Registered User
    Join Date
    08-29-2013
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    67

    If cell has date within certain timeframe, change color?

    I have some tasks in column A, column B has dates they are due. If they dates are within a timeframe (say due by end of the current month, or within the next 30 days, etc.) then I would like the color of that date cell to change (red in this case).

    For the columns, I have one column with:

    Time until due
    =DATEDIF(TODAY(),D4,"M")&" mo. "&DATEDIF(TODAY(),D4,"MD")&" days"

    Beside that is Target date column, each cell has a date (simple 06/16/2016 for example)

    So I'd like the "Time until due" cells to change color


    Thanks a lot for any help with this!

  2. #2
    Forum Contributor
    Join Date
    04-07-2009
    Location
    Rowley
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: If cell has date within certain timeframe, change color?

    Here is some Conditional Formatting that should give you what your looking for.

    Conditional Formatting 2007

    1) Select your cell or range of cells, IE B1:B100
    2) On the ribbon click Conditional Formatting
    3) Click on New Rules, it’s near the bottom of the dialog box.
    4) Click Use Formula to determine which cells to format.
    5) Enter one of the formulas from below.
    6) Click on the Format button
    7) Select the Fill Tab
    8) Select a pretty color
    9) Click OK
    10) Click OK

    Select which formula you need:

    90 Days before Today: =B1-TODAY()<90
    60 Days before Today: =B1-TODAY()<60
    30 Days before Today: =B1-TODAY()<30
    15 Days before Today: =B1-TODAY()<15
    5 Days before Today: =B1-TODAY()<5

    See how that works for you.

  3. #3
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: If cell has date within certain timeframe, change color?

    If the Target Dates are in Column B starting in row 2 (row 1 for titles) select the dates in column B and enter this formula in Conditional Formatting, Use formula and format as RED. This will format all dates due within a calendar month of today.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The period of time makes a difference in the way the calculation can be made so please be more specific with your requirements.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Last edited by newdoverman; 06-16-2016 at 08:20 PM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  4. #4
    Registered User
    Join Date
    08-29-2013
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    67

    Re: If cell has date within certain timeframe, change color?

    Thanks for your help guys, I have tried both ways. For some reason xenixman's method doesn't work for a few cells in the range I set conditional formatting for, does for others. newdoverman's method works correctly. How can I change with that method the time frame (from 1 calendar month to rolling 30 days or next 2 weeks, etc.)?

    Attached sample Excel file with the 2 columns, I want the column A (Time left) to be the one that gets red font highlighted based on time frame.
    Attached Files Attached Files

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: If cell has date within certain timeframe, change color?

    I added a helper column (can be hidden) that contained actual numeric data. I then added some Conditional Formatting rules to colour the background, that you should be able to follow. These rules are in 5 day increments and the order of the rules is important. The formulae are simple. All dates within 1 month have red font.
    =a2<=5 =a2<=10 etc.

    Any date more than 30 days doesn't have formatting applied to column B
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-29-2013
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    67

    Re: If cell has date within certain timeframe, change color?

    I tried applying that but whereas the helper column you added has those numeric values, in my spreadsheet that column is text goal names ("Master acoustic arrangement" "Save $1500 for trip" etc.) along with a cost column, so I have attached a workbook now with the actual format of my sheet, a few excerpts.
    Attached Files Attached Files

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: If cell has date within certain timeframe, change color?

    I changed some of the dates so that the formatting will show. If I hadn't, all the values would have had the same formatting.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    08-29-2013
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    67

    Re: If cell has date within certain timeframe, change color?

    Thank you that is working great! I've learned how to tinker with the conditional rules too, much appreciated

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: If cell has date within certain timeframe, change color?

    Thank you for the feedback and the rep.

+ 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. Change cell color according to date
    By hmvl44 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-09-2013, 07:40 AM
  2. Change Cell Color According To Date
    By msisk83 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 08-08-2013, 09:47 AM
  3. Macro to Change color of cell after cross referencing date with a given date.
    By liajet24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-24-2013, 12:33 PM
  4. Help Please!! Cell to change colour if timeframe exceeded based on several choices
    By Fran Habbitts in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-26-2012, 05:56 AM
  5. [SOLVED] change background row color with change of date in a cell
    By Urszula in forum Excel General
    Replies: 5
    Last Post: 05-17-2006, 03:00 AM
  6. cell color change based on due date
    By MINAL ZUNKE in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 06-30-2005, 05:05 PM
  7. Change cell color dependin on date ...
    By T. Denford in forum Excel General
    Replies: 16
    Last Post: 04-13-2005, 06:06 AM
  8. [SOLVED] Change cell color dependin on date ...
    By T. Denford in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-12-2005, 09:06 PM

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