+ Reply to Thread
Results 1 to 4 of 4

display number of days if less than 7 otherwise round up to months

  1. #1
    Registered User
    Join Date
    11-27-2007
    Posts
    6

    display number of days if less than 7 otherwise round up to months

    Hi.

    Sorry for the long title.

    What I am trying to do is to display the number of days between 2 dates if its less than 7 days Otherwise I need to display the number of Months between the dates rounded up (if the months =0)


    I hope I have explained that correctly!

    Thanks
    Chris
    Last edited by chrisio; 09-22-2012 at 12:44 PM. Reason: Resovled.

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: display number of days if less than 7 otherwise round up to months

    Perhaps..

    =IF(A2-A1<7,A2-A1,ROUNDUP((A2-A1)/30,0))

    Does your month equal to 30 days consistently?
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: display number of days if less than 7 otherwise round up to months

    One way

    =IF(AND(B1-A1>7,(MONTH(B1)-MONTH(A1)=0)),1,IF(B1-A1<=7,B1-A1,MONTH(B1)-MONTH(A1)+1))
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Valued Forum Contributor Sadath31's Avatar
    Join Date
    03-02-2011
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Office 365
    Posts
    452

    Re: display number of days if less than 7 otherwise round up to months

    hi
    if the cells A1 & B1 having dates then
    =IF((B1-A1)<=7,B1-A1,DATEDIF(A1,B1,"ym"))

+ 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