+ Reply to Thread
Results 1 to 8 of 8

DAYS function: correctly calculating the number of days

  1. #1
    Registered User
    Join Date
    07-29-2015
    Location
    Australia
    MS-Off Ver
    excel
    Posts
    11

    DAYS function: correctly calculating the number of days

    I'm using the Days function to calculate the number of days between certain dates.

    Days function does not include 1 of either the start of finish date. Thus if I input [ A1]01/01/15 [A2]31/01/15 [A3]=days(A1,A2) A3 returns 30 as per attachment.
    similarly 01/01/15 - 31/12/15 = 364.

    It would be be a simple matter to modify the return to =days(A1,A2)+1 however I wondered if there was a better function available?
    Attached Files Attached Files

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: DAYS function: correctly calculating the number of days

    You can simply subtract:

    =A2-A1+1
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    08-25-2015
    Location
    London, England
    MS-Off Ver
    excel 2013
    Posts
    12

    Re: DAYS function: correctly calculating the number of days

    You can use DATEDIF function:
    =datedif(A1,A2,"d")

    https://www.youtube.com/watch?v=PaD1P1QwnB4
    Last edited by John90; 09-02-2015 at 10:11 PM.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: DAYS function: correctly calculating the number of days

    Quote Originally Posted by John90 View Post
    You can use DATEDIF function:
    =datedif(A1,A2,"d")
    You still have to add 1.

    =DATEDIF(A1,A2,"d")+1

  5. #5
    Registered User
    Join Date
    07-29-2015
    Location
    Australia
    MS-Off Ver
    excel
    Posts
    11

    Re: DAYS function: correctly calculating the number of days

    Book1.xlsx=DATEDIF(A2,B2,"d") returns 30 days as per attached sheet this post.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: DAYS function: correctly calculating the number of days

    Yes, but you said this:

    Quote Originally Posted by dadpad View Post
    It would be be a simple matter to modify the return to =days(A1,A2)+1
    So I assume you want to count every day in the range. If so, then, no matter what method you use you'll have to add 1.

  7. #7
    Registered User
    Join Date
    07-29-2015
    Location
    Australia
    MS-Off Ver
    excel
    Posts
    11

    Re: DAYS function: correctly calculating the number of days

    Quote Originally Posted by Tony Valko View Post
    So I assume you want to count every day in the range. If so, then, no matter what method you use you'll have to add 1.
    Ok thanks tony. you've confirmed what i suspected. It seems odd to me that [DAYS] does not count all days within a range. I can cope with adding +1 to the formula. I just wondered if there was a better/different/accurate option.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: DAYS function: correctly calculating the number of days

    You're welcome. Thanks for the feedback!


    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this 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)

Similar Threads

  1. Replies: 0
    Last Post: 10-31-2014, 10:32 AM
  2. Calculating number of days, help.
    By DollyMixture in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-23-2014, 11:01 AM
  3. Replies: 2
    Last Post: 02-20-2014, 06:40 AM
  4. [SOLVED] Calculating days between days by individual person
    By mistert in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-22-2013, 02:18 AM
  5. [SOLVED] Calculating the number of days
    By bremen22 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-09-2013, 12:06 PM
  6. calculating the number of days
    By Deanomcbeano in forum Excel General
    Replies: 12
    Last Post: 10-02-2012, 08:22 AM
  7. Calculating time elapsed in days and count days within same range
    By michellem410 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-19-2008, 01:13 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