+ Reply to Thread
Results 1 to 10 of 10

Need a conditional formatting formula for cells with dates

  1. #1
    Registered User
    Join Date
    07-17-2021
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    77

    Need a conditional formatting formula for cells with dates

    I need a conditional formatting formula that would turn a cell a different color if the date shown in cell A2 were greater than the date in cell A1 by 2 days.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Need a conditional formatting formula for cells with dates

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-17-2021
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    77

    Re: Need a conditional formatting formula for cells with dates

    Hmmm, that didn't work. It just changed the color in all my cells in the range that are blank that are not returning any data from the formula yet. I attached a sample workbook. The actual column in my sheet is AB where the conditional formatting formula is that I need that I described in this post. I'm getting color in my columns R and T as well in the blanks for those conditional formatting formulas in those ranges. Haven't been able to figure out why. Those conditional formatting formulas in columns T and R do work as intended though when the formulas in the cells return data. Just not sure why the blank are changing color.
    Attached Files Attached Files

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Need a conditional formatting formula for cells with dates

    Not the most useful sample workbook . No data, no Conditional Formatting, nothing, completely empty

    This formula might work better:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    That said, with the original formula, the CF behaved oddly until I put a formula in to check the CF condition, then it worked properly.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-17-2021
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    77

    Re: Need a conditional formatting formula for cells with dates

    Something else must be off. The blank cells turning red went away, but still not getting the cell to turn red if the date is 2 days or more than the other cell's date.

    Please see column AB.
    Attached Files Attached Files

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Need a conditional formatting formula for cells with dates

    You need to check a) the formula and b) competing CF conditions.

    This:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    should probably be this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And you also have a test for M5 = 0 with a grey format. M5 IS zero so AB5 is grey.

    For future reference, it's always better if the description of the requirement and the sample file(s)are representative of the live file.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-17-2021
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    77

    Re: Need a conditional formatting formula for cells with dates

    So that new formula did change the cell red when the date in H was 2 days before the date in AB, however it turned the entire range red instead of just that cell, including the cells with dates that the condition is not true in.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Need a conditional formatting formula for cells with dates

    You only have one row in your sample file …

    Maybe you need to change the row number in the formula from absolute to relative. That is, remove the dollar

    =AND($H5<>"", $AB5<>"", $AB5>=$H5+2)

  9. #9
    Registered User
    Join Date
    07-17-2021
    Location
    Dallas, TX
    MS-Off Ver
    Office 365
    Posts
    77

    Re: Need a conditional formatting formula for cells with dates

    Yes, removing the extra $ in the formula fixed. I chopped the workbook down to just one sheet and one row to get it under the file size limit. Thank you! I check my conditional formulas in R and T to see if I had a similar issue there but it doesn not seem that is the case. That conditional formula works fine but is turning my blanks cells in the column red with no returned data from formulas. Any idea what is causing that?

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Need a conditional formatting formula for cells with dates

    Which specific cells in which specific columns are a problem.

    Please provide a sample workbook with more, and more specific examples.

    You probably need to check ALL your CF conditions. You have a lot that are applied to single cells which could probably be consolidated and some that appear to apply to full columns. That might make your workbook unnecessarily large and affect performance.
    Attached Images Attached Images

+ 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. Need a 'conditional formatting' formula to highlight cells between dates/text
    By BigSean762 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-29-2014, 02:33 PM
  2. Use conditional formatting to shade cells between two dates
    By vandeverja in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-27-2014, 11:58 AM
  3. [SOLVED] Conditional Formatting for cells based on dates in subsequent cells
    By bcmilne in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-09-2014, 10:23 AM
  4. Replies: 11
    Last Post: 05-04-2014, 08:28 PM
  5. Replies: 4
    Last Post: 08-29-2013, 11:23 AM
  6. Replies: 5
    Last Post: 09-24-2012, 05:14 PM
  7. conditional formatting for dates based on three three cells.
    By jwelch176 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-31-2012, 03:03 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