+ Reply to Thread
Results 1 to 6 of 6

Number of days between two dates but include current date in the count

  1. #1
    Registered User
    Join Date
    05-20-2015
    Location
    UK
    MS-Off Ver
    2007
    Posts
    6

    Number of days between two dates but include current date in the count

    Hi Everyone

    Really hoping i can get some help here with the below problem.

    I want to work out the days between two dates but also include the start day in the count. I then have then split into 4 different potential periods. I've tried the simple solution of minusing the dates in the example.

    7/7/15 - 20/7/15 The difference here is 14 day including the 7/7 date. The problem is when i do the normal subtraction e.g A2-A3 is doesnt pick up the starting day (7/7) and shows 13 days. I know i can add +1 but this then shows a 1 in the cells which should be blank.

    I then have a separate cell shows the total number of days added together from separate spells

    I've tried using for example =DATEDIF(B14-1,E14,"D") in the example below:

    Date Date Total days

    Maternity - start 07/07/2015 Maternity - end 20/07/2015 14

    SPL period 1 - start 21/07/2015 SPL period 1 - end 13/06/2016 329

    SPL period 2 - start 21/07/2015 SPL period 2 - end 03/08/2015 14

    SPL period 2 - start 17/08/2015 SPL period 3 - end 23/08/2015 7

    SPL period 2 - start SPL period 4 - end #NUM!

    Total leave days taken #NUM!

    This does work but only if all the date periods are completed which isnt always the case, this also knocks out total leave days (sumof) because of the blank cells.

    Does anyone have any ideas which will give me the result i need and no messages in the cells? Any help would be massively appreciated.

    Thanks

    J

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Number of days between two dates but include current date in the count

    It should just be

    =B1-A1+1

    A1 = Start Date
    B1 = End Date


    Now you say it 'doesn't work' when both dates are not completed.
    What do you want the result to be in that case, left blank?
    Try
    =IF(COUNT(A1,B1)=2,B1-A1+1,"")

  3. #3
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Number of days between two dates but include current date in the count

    You can wrap an IFERROR() around your formula like this
    Please Login or Register  to view this content.

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Number of days between two dates but include current date in the count

    With your sample data in A1:D6
    this formula, copied down, returns the count of days where start and end dates exist
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  5. #5
    Registered User
    Join Date
    05-20-2015
    Location
    UK
    MS-Off Ver
    2007
    Posts
    6

    Re: Number of days between two dates but include current date in the count

    Thanks all, I really appreciate the help. This has done the trick and is working perfect now.

    Even better is that i actually understand it too! Will continue trying to up my knowledge level.

    Thanks again guys

    J

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Number of days between two dates but include current date in the count

    You're welcome.

+ 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. Help on count the number of days in between dates and then average number of days
    By Barbara Excel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-30-2013, 12:13 PM
  2. Replies: 10
    Last Post: 02-26-2012, 07:34 PM
  3. Replies: 0
    Last Post: 02-26-2012, 06:11 PM
  4. count < or > 15 days from current date
    By paulcraigdainty in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-20-2007, 01:45 PM
  5. [SOLVED] Count number of days between dates BUT IF null to current date
    By kathi in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-14-2006, 12:15 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