+ Reply to Thread
Results 1 to 9 of 9

Datedif of two dates, limited to a specific period

  1. #1
    Registered User
    Join Date
    07-13-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2008 Mac
    Posts
    6

    Datedif of two dates, limited to a specific period

    Hi team,

    I have a list of dates for when a number of apartments were occupied, and I'm trying to work out how many days they were occupied during each quarter. E.G.:

    Apartment 1
    Occupied from 1/1/2008 (date in cell A1) to 27/4/2008 (B1)
    Occupied from 27/6/2008 (A2) to 9/9/2009 (B2)

    (I'm using the non-American date syntax of dd/mm/yyyy)

    So I can manually count that the apartment was occupied for 91 days in Q1 of 2008 (from 1 Jan to 31 Mar), and 31 days in Q2 (1 Apr to 30 Jun). But is there a formula that can do a DATEDIF count of A1:B2, but limited to a date range, e.g., 1/1/2008-31/3/2008?

    I hope that makes sense...

    Cheers,
    Jesse

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Datedif of two dates, limited to a specific period

    It is confusing, please attach sample examples with some more example and expected result
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Forum Contributor
    Join Date
    03-11-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    379

    Re: Datedif of two dates, limited to a specific period

    Hi Jesse,

    Please explain
    limited to a date range, e.g., 1/1/2008-31/3/2008?
    Regards,
    AM

  4. #4
    Registered User
    Join Date
    07-13-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2008 Mac
    Posts
    6

    Re: Datedif of two dates, limited to a specific period

    Of course, I'll do my best.

    I'd like to know how many days in each Quarter an apartment was occupied. The data I have to work with is the start and end dates of the occupancy. Here's a screenshot of the data range I'm working with.
    Screen Shot 2015-04-22 at 2.57.30 pm.png

    Here's a screenshot of the eventual data I'd like to fill out. Cell C6 is correct, but it's a simpler calculation. The others are incorrect...
    Screen Shot 2015-04-22 at 3.05.50 pm.png

    Manually, I can count that the results look like this:
    Q4 (1 Oct-31 Dec) in 2007 is 87 days (the occupancy started 6/10/2007, ending at the end of the Quarter)
    Q1 (1 Jan-31 Mar) in 2008 is 91 days (occupancy took up the entire Quarter)
    Q2 (1 Apr-30 Jun) in 2008 is 31 days (first occupancy ended on 27/4/2008, then empty until a new occupancy started 27/6/2008 to the end of the Quarter)
    Q3 (1 Jul-30 Sep) in 2008 is 92 days (occupancy took up the entire Quarter)

    But I'd like a formula to calculate it automatically.

    Does this clarify things at all?

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Datedif of two dates, limited to a specific period

    don't mind instead of image post excel file

  6. #6
    Registered User
    Join Date
    07-13-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2008 Mac
    Posts
    6

    Re: Datedif of two dates, limited to a specific period

    Here's the full Excel file - sorry, I didn't realise I could attach it directly.

    Apartment Occupancy example.xlsx

  7. #7
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Datedif of two dates, limited to a specific period

    see the attached file two helper columns created for period

    The give formula is an array formula
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-13-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2008 Mac
    Posts
    6

    Re: Datedif of two dates, limited to a specific period

    nflsales - you're amazing!

    I kind of understand what's going on, but clearly I need to expand my knowledge of Excel, especially regard arrays. In the meantime, this does exactly what I was after, and I sincerely thank you for it!

  9. #9
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Datedif of two dates, limited to a specific period

    You are welcome and thanks for adding reputation

+ 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. Display dates of a specific day in a given period of time
    By krz1407 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-06-2013, 09:42 AM
  2. Using DATEDIF for future dates
    By xana in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-09-2011, 12:48 PM
  3. counting unique entries for a specific date period in a series of dates
    By woody382 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-16-2010, 01:57 PM
  4. how to get the (average or sum) in a limited period of time
    By voltaire101 in forum Excel General
    Replies: 6
    Last Post: 01-23-2009, 07:35 AM
  5. Datedif Calculation between to dates?
    By Ethos in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-23-2007, 04:50 AM

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