+ Reply to Thread
Results 1 to 9 of 9

Applying three datedif formulas to one cell

  1. #1
    Registered User
    Join Date
    01-03-2021
    Location
    SF Bay Area, California
    MS-Off Ver
    365
    Posts
    4

    Applying three datedif formulas to one cell

    Hello,

    I'm having a difficult time getting straight forward guidance on a specific set of conditional formulas.

    User Story: I am a training manager needing to color code cells in the Training Date (I) column to reflect the following conditions:

    1. 1 year or more, past date of last training = highlight red

    2. Greater than or equal to 9 months past date of last training but less than 1 year = highlight yellow

    3. Less than 9 months since date of last training = highlight in green

    I've tried what's below. I think it's getting close but could really use some help.

    =DATEDIF($I1,TODAY(),"y")>1 = RED

    =DATEDIF($I5,TODAY(),"m")>=9 = YELLOW

    =DATEDIF($I5,TODAY(),"m")<=9 = GREEN

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,459

    Re: Applying three datedif formulas to one cell

    Use
    =DATEDIF($I5,TODAY(),"ym") instead of "m" only
    Quang PT

  3. #3
    Registered User
    Join Date
    01-03-2021
    Location
    SF Bay Area, California
    MS-Off Ver
    365
    Posts
    4

    Re: Applying three datedif formulas to one cell

    BERT column I.png

    Thanks Quang,

    I've included a screenshot of the column. After making your suggested change the red condition appears to be working but there are conflicts with the yellow and green.

    Any ideas?

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,459

    Re: Applying three datedif formulas to one cell

    Try again:

    red:
    =$I5 < EDATE(TODAY(),-12)

    yellow
    =$I5 < EDATE(TODAY(),-9)

    green
    =$I5 >= EDATE(TODAY(),-9)

    If it does not work, try to upload a sample spreadsheet

  5. #5
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Applying three datedif formulas to one cell

    =MATCH($I5,EDATE(TODAY(),{0;-12;-9})*{0;1;1})

    would be 1 for I5 more than a year before TODAY(), 2 for I5 between 12 and 9 months before TODAY(), and 3 for less than 9 months before TODAY().

  6. #6
    Registered User
    Join Date
    01-03-2021
    Location
    SF Bay Area, California
    MS-Off Ver
    365
    Posts
    4

    Re: Applying three datedif formulas to one cell

    Hi Quang,

    No luck. I have attached a sample. Thank you sir.

    -Sean
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Applying three datedif formulas to one cell

    Sorry. I didn't test, and I forgot conditional formatting formulas can't use array constants.

    If you define the names __cf_array_1 referring to ={0;-12;-9}, and __cf_array_2 referring to ={0;1;1}, then with all cells selected and H5 the active cell,

    more than a year old:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    between 9 and 12 months old:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    less than 9 months old:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-03-2021
    Location
    SF Bay Area, California
    MS-Off Ver
    365
    Posts
    4

    Re: Applying three datedif formulas to one cell

    Thank you hrlngrv,

    I see the formulas worked in the sample spreadsheet. When I attempt to input them into my original, only cells with no value show up as yellow. The rest have no highlighting. I'm thinking something might be wrong with the formatting in the original spreadsheet. I'm curious why the new formulas reference column H?

    Thank you,

    Sean

  9. #9
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Applying three datedif formulas to one cell

    Quote Originally Posted by fish1775 View Post
    . . . I'm curious why the new formulas reference column H? . . .
    The sample workbook you provided had a formatted range spanning columns H to J with the topmost cell in row 5. I may have misinterpreted the sample workbook. I treated each column as containing a date which should be evaluated. If only column I should be, and its result applied to columns H to J, then use $I instead of H.

+ 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. [SOLVED] DATEDIF formulas between date
    By R0CKY in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-15-2018, 08:10 AM
  2. [SOLVED] Need help with applying conditional formulas!
    By hawaean in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 12-09-2016, 06:12 PM
  3. Applying Formulas To Columns That Are Not Populated
    By AFG03082015 in forum Excel General
    Replies: 3
    Last Post: 08-03-2016, 09:35 AM
  4. [SOLVED] DATEDIF - DATEDIF Calculation returning a negative for days or months
    By DaveBre in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-27-2015, 06:22 PM
  5. Applying two simple formulas and an edit whenever a row has a missing cell
    By AntiPivotTable in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-06-2015, 05:55 PM
  6. applying formulas using cell references
    By engrpetero in forum Excel General
    Replies: 6
    Last Post: 12-18-2009, 05:21 PM
  7. Applying Formulas to Visible Cells Only
    By SteveC in forum Excel General
    Replies: 7
    Last Post: 06-26-2006, 06:50 PM

Tags for this Thread

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