+ Reply to Thread
Results 1 to 3 of 3

Working between two months-Dates

  1. #1
    Registered User
    Join Date
    08-21-2011
    Location
    Paris
    MS-Off Ver
    MIcrosoft Excel for Mac 2011
    Posts
    11

    Question Working between two months-Dates

    Hi guys,

    I'm sort of an amateur user of Excel just discovering more complicated functions, but I've hit a wall on a piece of work I'm doing.

    Basically I'm working out a spreadsheet for an apartment company, and I need to be able to calculate number of days between two dates, divide the rent by that and work out how much was paid for the night.
    I've managed to succeed with that, but I have a slight problem concerning dates between months, e.g. 28/08/2011 until 03/09/2011- I need to be able to work out what money was paid for August, i.e. the 28/08 to the 01/09 and then the monies paid in September for the rest of the month.
    This also needs some kind of message to indicate the division between the two months.
    I did try doing this the long way- working out the dates between the two months and then dividing the rent accordingly but it seems a bit convoluted, has anyone got any ideas?

    Do I need to explain this better? Any help on the matter would be greatly appreciated.

    Kindest regards

    Skip08 (newbie)
    Attached Files Attached Files
    Last edited by skip08; 08-21-2011 at 11:05 AM.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Working between two months-Dates

    The formula for the days in the first month is

    =IF(MONTH(G5)>MONTH(F5),G5-F5-DAY(G5),G5-F5)

    the second is

    =IF(MONTH(G5)>MONTH(F5),G5-(G5-DAY(G5)),0)

    By the way you just need = G5-F5 for the 'Nombre de jours'

    You might also need to replace my commas (,) with semi-colons ( if you have a French language Excel.

  3. #3
    Registered User
    Join Date
    08-21-2011
    Location
    Paris
    MS-Off Ver
    MIcrosoft Excel for Mac 2011
    Posts
    11

    Re: Working between two months-Dates

    Quote Originally Posted by Bob Phillips View Post
    The formula for the days in the first month is

    =IF(MONTH(G5)>MONTH(F5),G5-F5-DAY(G5),G5-F5)

    the second is

    =IF(MONTH(G5)>MONTH(F5),G5-(G5-DAY(G5)),0)

    By the way you just need = G5-F5 for the 'Nombre de jours'

    You might also need to replace my commas (,) with semi-colons ( if you have a French language Excel.
    Thanks so much for your prompt response! This has been a big help, but I need to be a bit cheeky and ask for a little bit more. The month function seems to be the way to go, but I need to include the night of the 31st in a client's stay, i.e. a stay from the 28th of August to the 5th of September would have 4 nights rather than 3 days. Is there any precision I can make to this formula to achieve this?

    Edit: Just added one to one formula and subtracted from the other, SORTED!
    You're a legend Bob!
    Thanks again :D
    Last edited by skip08; 08-21-2011 at 11:04 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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