+ Reply to Thread
Results 1 to 2 of 2

CF for expiry year only

  1. #1
    Registered User
    Join Date
    06-17-2021
    Location
    UK
    MS-Off Ver
    2105
    Posts
    1

    Post CF for expiry year only

    Hi folks,

    quite new to making excel documents but ive been using excel for alot longer. Never really knew just how much you can do with the program!

    Im trying to put together a spreadsheet for my own purposes that track out of date equipment.

    Ive worked out how to give me a green, yellow and red condition if the relief valve is in date, close to the expiry date or out of date by using the "Last month" This month" and "Next month" although it would be much better if it was 3 months.

    The primary reason for the post is im using the TODAY() function which gives me the date, Ive formatted that to show the YEAR only.
    The conditional formatting i require is when equipment is out of date in say 2026 (fitted last week) this will turn green, when the TODAY() date gets to 01/01/2026 the conditional formatting will change this to Orange (as a warning, its close to its expiry date) and 01/01/2027 being red when the equipment is Out of date

    Is this possible from 01/01/ of the year, all the other ways ive looked at takes it from the current date/month/year + 1825 (5 years)

    Any suggestions would be greatly appreciated.

    Best Regards

  2. #2
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: CF for expiry year only

    Welcome to the forum.

    I'm not 100% from your question exactly what you want or the full extent of your problem, but I think part of it is that you have 'formatted that to show the YEAR only'. Formatting in Excel doesn't change the base data, only the way in which you view it. So when you format a date to show the year only, the underlying date is still day-month-year. (Actually, in Excel a date is just a number, with 1 being 1st Jan 1900 - but that's not relevant to this point.)

    If you want to check against the year only, you need to convert your dates to just years. Luckily you can do this easily with the YEAR function.
    =YEAR(TODAY()) will give you the year for today (2021 right now).
    =YEAR(A1) will give you the year of the date in A1 (assuming there's a date in A1).

    So, let's say you have a date from 2021 which is stored in A1 and you want it to show as near expiry when you reach 1st Jan 2026 because that's nearly 5 years later, you can use this as your CF formula:
    =YEAR(TODAY())=YEAR(A1)+5
    For past expiry, just replace the second = sign with > instead:
    =YEAR(TODAY())>YEAR(A1)+5


    You also note that you'd prefer 3 months to 'next month'. Try using EDATE or EOMONTH for this.
    With your date in A1, use this CF formula to give you a check if today is 3 months or more later:
    =TODAY()>=EDATE(A1,3)
    To check if today is in that third month, you could use this:
    =TODAY()>EOMONTH(A1,2)

    Give those a go and get back to us if you need more explanation or help.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

+ 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] Highlighting Expiry dates but with dates that have passed the expiry duration, not date.
    By smurf54454 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-15-2019, 06:04 AM
  2. [SOLVED] Count days before expiry date & after Expiry date in one formula
    By Macfool in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-16-2017, 02:58 PM
  3. function tell who in this month of this year Expiry
    By zEr. in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-01-2016, 07:58 AM
  4. [SOLVED] Help with formula to return a value based on if that expiry date is within year
    By mw91 in forum Excel Formulas & Functions
    Replies: 25
    Last Post: 01-08-2015, 11:37 AM
  5. autocalculate expiry date / expiry date colour warnings
    By kimbling1 in forum Excel General
    Replies: 8
    Last Post: 08-27-2014, 02:53 AM
  6. Automatically update year interval cycles from year to year
    By trumptight in forum Word Programming / VBA / Macros
    Replies: 8
    Last Post: 08-21-2014, 10:38 PM
  7. Replies: 3
    Last Post: 09-04-2013, 10:49 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