+ Reply to Thread
Results 1 to 8 of 8

Massive =IF together with =DATE formula

  1. #1
    Registered User
    Join Date
    11-03-2011
    Location
    Holt
    MS-Off Ver
    Excel 2010
    Posts
    27

    Massive =IF together with =DATE formula

    Hello.
    I am trying to create a formula which will have date as an output depending on variable.
    Variable are following:

    4
    5
    L6
    U6

    The idea is to add a certain amount of years and month to the TODAY date, depending on the variable.
    The output date (month and day) are pre-defined = 1 of May
    Though the year varies. It will be 4 years for 4, 3 years for 5, 2 years for L6 and 1 year for U6.
    The trick is that most students will be registered in september, but some might register after new year and this is where I am not sure of how to make year add up correct.
    I tried to make up this formula which gives output of 42491 =\


    =IF(B5=3; DATE(YEAR(C11)+4;MONTH($D$2);DAY($D$2)); IF(B5=4;DATE(YEAR(C11)+4;MONTH($D$2);DAY($D$2)); IF(B5=5;DATE(YEAR(C11)+3;MONTH($D$2);DAY($D$2)); IF(B5=L6;DATE(YEAR(C11)+2;MONTH($D$2);DAY($D$2)); IF(B5=U6;DATE(YEAR(C11)+5;MONTH($D$2);DAY($D$2));0)))))
    Last edited by beseda2004; 02-08-2012 at 07:07 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Massive =IF together with =DATE formula

    Your question is not very clear. What are you trying to accomplish? Do you have an excel file that you can attach that will help explain your issue?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    11-03-2011
    Location
    Holt
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Massive =IF together with =DATE formula

    Microsoft Excel Worksheet.xlsx
    Here it is with more clarified question inside

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

    Re: Massive =IF together with =DATE formula

    Put the values 4,3,2,1 in cells L2 to L5, and then you can use this formula in B5:

    =IF(B2="","",DATE(YEAR(B4)-IF(AND(MONTH(B4)>=1,MONTH(B4)<8),1,0)+VLOOKUP(B2,K$2:L$5,2,0),5,1))

    If the current date is between January and August of one year, then the year values are subtracted by one year.

    Hope this helps.

    Pete

    EDIT: I've attached your workbook with the changes in it.
    Attached Files Attached Files
    Last edited by Pete_UK; 02-07-2012 at 09:08 AM.

  5. #5
    Registered User
    Join Date
    11-03-2011
    Location
    Holt
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Massive =IF together with =DATE formula

    Soz Pete dooesn't want to work for some reason... Says that formula contains error, thou I can't see it.

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

    Re: Massive =IF together with =DATE formula

    Have you looked at the file that I attached?

    Pete

  7. #7
    Registered User
    Join Date
    11-03-2011
    Location
    Holt
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Massive =IF together with =DATE formula

    Thanks Pete worked well!

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

    Re: Massive =IF together with =DATE formula

    You're welcome - thanks for feeding back.

    Pete

    PS You might like to mark the thread as Solved.

+ 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