+ Reply to Thread
Results 1 to 4 of 4

How to calculate number of days between two dates by month

  1. #1
    Registered User
    Join Date
    10-05-2014
    Location
    UK
    MS-Off Ver
    2013
    Posts
    12

    How to calculate number of days between two dates by month

    Hello,

    I'm trying to create a formula I need urgently.

    We are trying to extract details on customer hotel bookings to show how many their booking dates fall over calendar months. e.g. customer A has arrived on 24th June and departed on the 11th of July.

    The spreadsheet is set up so that arrival date is in column B, departure date in column C and then calendar months Jan-Dec in column D onwards.

    the formula would need to work so that it returns "0" in for example column D (January through to May) because the customer didn't arrive until June. The formula would then pick up that in June the customer was in the hotel from the 24th to the 30th so returning a result of "7". It would also then show a result in the Column for July of "10" as the departure date wouldn't be counted as a booked date.

    I can understand how to calculate the number of days between two dates but not how to correctly use an IF formula or similar to get the results needed as above.

    Matt

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to calculate number of days between two dates by month

    put this formula into d2 and fill down and across.
    D2 to o2 must have the numbers 1 to 12. Otherwise the formula gets interesting.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Re: How to calculate number of days between two dates by month

    Maybe this will work for what you're looking for:

    Book1.xlsx

    Note that the top row containing the month names do not necessarily need to be spelled out. They are actually formulas which are formatted in "mmmm" style (so if you wish to change the spelling of them, do not manually type over them, but simply change their formatting. This gives you freedom to spell them out, abbreviate them, or use month numbers).

    The formula provided works for any range in which the departure date is after the arrival date (as is expected), and any range which is less than 1 year in length. It will even account for leap years.
    Last edited by clabulis; 10-05-2014 at 08:03 PM.

  4. #4
    Registered User
    Join Date
    04-06-2015
    Location
    Cairo
    MS-Off Ver
    2013
    Posts
    1

    Re: How to calculate number of days between two dates by month

    How can I change the formula to include years?

    Thanks,
    A.

+ 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. [SOLVED] Calculate number of days in a month between two dates
    By schlomo87 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-04-2014, 12:32 AM
  2. Calculate the number of working days month wise in a given period using VBA
    By rakesh3235 in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 08-21-2014, 07:00 AM
  3. [SOLVED] How to calculate Year, Month and Day from total number of days?
    By Indra Rai in forum Excel General
    Replies: 4
    Last Post: 06-25-2014, 02:08 PM
  4. Replies: 15
    Last Post: 06-03-2014, 02:08 PM
  5. [SOLVED] Formula needed to calculate working days in specified month between two dates
    By webfeet2 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-24-2013, 02:19 AM

Tags for this Thread

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