+ Reply to Thread
Results 1 to 3 of 3

DateDif equation in an IF formula using roundup

  1. #1
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    DateDif equation in an IF formula using roundup

    Hello-

    Does anyone know if I can "tweak" a formula to round a date up when it is inside of a longer equation?

    I've attached a sample.

    I can get the formula to work... with one exception, I cannot leave the cell blank or it will populate with one.

    I tried to use plain datedif however since the end date is the end of the month, the formula thinks that the number of months is 1 month shorter than it really is. I had to add +1 after each part of the formula. Thus resulting in an accurate answer.

    The problem is, if the dates are blank, the answer will be one.

    I cannot use conditional formatting since there is the offchance that there will be a true 1 month answer.

    Is there a way I can change the formula to only roundup the end date to the next month when calculating the formula?
    Attached Files Attached Files

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: DateDif equation in an IF formula using roundup

    How about introducing another IF()

    e.g

    =IF(B2="","",IF(A2>D2,DATEDIF(A2,B2,"M")+1,DATEDIF(D2,B2,"M")+1))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: DateDif equation in an IF formula using roundup

    Perhaps just

    =DATEDIF(MAX(A2,D2),B2+1,"M")

+ 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