+ Reply to Thread
Results 1 to 10 of 10

IF AND statements with dates

  1. #1
    Registered User
    Join Date
    10-22-2014
    Location
    Southampton
    MS-Off Ver
    Excel 2010
    Posts
    3

    IF AND statements with dates

    I am very inexperienced with this type of formula. Can someone help me correct the following:

    Please Login or Register  to view this content.
    In B4 I can have 0,50 or 100. If the result is 0, I want it to enter the current date plus 3 years. If the result is 50, then I want it to enter the current date plus 2 years and finally (I gave up at this point) if the result is 100 I want it to put the date plus 1 year. The first bit works, ie upto the 1095, but the rest doesn't. Any ideas appreciated.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF AND statements with dates

    use edate and today
    =IF(B4=0,EDATE(TODAY(),36),IF(B4=50,EDATE(TODAY(),24),IF(B4=100,EDATE(TODAY(),12),"")))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Valued Forum Contributor
    Join Date
    04-09-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    391

    Re: IF AND statements with dates

    Hi,

    Put 0,50,100 in D1:D3 and 1095,730,365 in E1:E3,

    Than use below formula:

    =LOOKUP(B4,D1:D3,NOW()+E1:E3)

  4. #4
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: IF AND statements with dates

    and now for something completely different

    Please Login or Register  to view this content.
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  5. #5
    Registered User
    Join Date
    10-22-2014
    Location
    Southampton
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: IF AND statements with dates

    Worked like a dream....I see I have a lot to learn! Thanks

  6. #6
    Registered User
    Join Date
    10-22-2014
    Location
    Southampton
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: IF AND statements with dates

    Thanks very much

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF AND statements with dates

    or
    =EDATE(TODAY(),(3-B4/50)*12)
    note adding
    1095,730,365 does not account for leap years
    edate() does

  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,813

    Re: IF AND statements with dates

    One way:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS
    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


  9. #9
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: IF AND statements with dates

    Isn't amazing how many different ways you can do the same thing....WOW...

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  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,813

    Re: IF AND statements with dates


    A
    B
    C
    D
    1
    0
    1095
    2
    50
    730
    3
    100
    365
    4
    0
    22/10/2017
    =IFERROR(DATE(YEAR(TODAY())+CHOOSE(MATCH(B4,{0,50,100},0),3,2,1),MONTH(TODAY()),DAY(TODAY())),"invalid")
    5
    22/10/2017
    =EDATE(TODAY(),(3-B4/50)*12)
    6
    21/10/2017
    =IF(B4=0,NOW()+1095,IF(B4=50,NOW()+730,NOW()+365))
    7
    21/10/2017
    =LOOKUP(B4,A1:A3,NOW()+B1:B3)
    8
    22/10/2017
    =IF(B4=0,EDATE(TODAY(),36),IF(B4=50,EDATE(TODAY(),24),IF(B4=100,EDATE(TODAY(),12),"")))
    9
    10
    11
    12
    In B4 I can have 0,50 or 100. If the result is 0, I want it to enter the current date plus 3 years. If the result is 50, then I want it to enter the current date plus 2 years and finally (I gave up at this point) if the result is 100 I want it to put the date plus 1 year. The first bit works, ie upto the 1095, but the rest doesn't. Any ideas appreciated.



    Regards, TMS

+ 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. Using if then statements in regards to dates
    By Spenserk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-28-2014, 07:08 PM
  2. Using Dates in IF statements
    By jbutzer72 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-18-2013, 11:35 AM
  3. Help with Dates and IF Statements
    By chrysti in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-19-2006, 04:57 PM
  4. Dates in IF statements
    By ScottEslick in forum Excel General
    Replies: 8
    Last Post: 01-19-2006, 08:49 PM
  5. [SOLVED] if statements & dates?
    By Lynn in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-19-2005, 12:05 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