+ Reply to Thread
Results 1 to 8 of 8

Need help with formula that includes dates

  1. #1
    Registered User
    Join Date
    11-27-2012
    Location
    Plattsburgh
    MS-Off Ver
    Excel 2007
    Posts
    5

    Smile Need help with formula that includes dates

    I'm trying to create a formula that delivers the result: If the employee's start date is on or before 1/1/03 AND their birth date is on or before 1/1/58. From the data I provided in an example spreadsheet, I'm trying to identify just those employees with at least 10 years of experience as of 1/1/13 AND who will also be 55 years as of 1/1/13.

    Hope someone can help. If not I will have to figure it out the old way by hand.

    Thanks. Have a nice day!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    11-05-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    229

    Re: Need help with formula that includes dates

    Hi kirkts!
    Welcome to the forum

    Put the following formula in D2 in your sheet, and copy down:
    =IF(AND(B2<=DATE(2003,1,1),C2<=DATE(1958,1,1)),"Meets Criteria","Doesn't Meet Criteria")

    You can use whatever text you want in place of "Meets Criteria" and "Doesn't Meet Criteria"

    Don't forget to click the little star at the bottom left of this post if you feel I helped!
    Taming the Excel dragon... www.TheExcelphile.com

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,725

    Re: Need help with formula that includes dates

    Put this formula in D2:

    =IF(AND(B2<=--"01/01/2003",C2<=--"01/01/1958"),"Yes","No")

    then copy down to the bottom of your data.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    11-27-2012
    Location
    Plattsburgh
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Need help with formula that includes dates

    Thank you both very much for your help! Worked like a charm!


    Have a fabulous day!

  5. #5
    Forum Contributor Steve N.'s Avatar
    Join Date
    12-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    298

    Re: Need help with formula that includes dates

    Pete -

    Can you explain the -- in the formula? First Iv'e seen that. Always trying to learn something new...

    Steve

  6. #6
    Forum Contributor
    Join Date
    11-05-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    229

    Re: Need help with formula that includes dates

    Hi Steve!

    The -- is used when you want Excel to treat text in a formula as a number. In Pete's formula, he is comparing dates. If he kept "01/01/2003" as it is, Excel would treat it as text, not as a date. By using --, he is telling Excel to treat it as a number, because Excel stores dates as numbers.

    Hope this makes sense

  7. #7
    Registered User
    Join Date
    11-27-2012
    Location
    Plattsburgh
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Need help with formula that includes dates

    Good question Steve! Thanks for asking. I was wondering the same thing.

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,725

    Re: Need help with formula that includes dates

    I did it that way, i.e. as text forced into a date with --, as it is a bit easier to read than DATE(year,month,day), but it does exactly the same thing.

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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