+ Reply to Thread
Results 1 to 20 of 20

Excel formula for calculating number of room nights

  1. #1
    Registered User
    Join Date
    06-01-2015
    Location
    india
    MS-Off Ver
    Windows 7
    Posts
    15

    Post Excel formula for calculating number of room nights

    Hi! I am running a guest house and need to calculate the number of room nights. The check in and check out times are at noon. If some one checks in 1 hr before noon or checks out one hour after noon, each should count as one night extra.

    A1 B1 C1
    27 May 2015 01:35 29 May 2015 18:20 3

    For example if I put above values in cells A1 and B1, then C1 should give me 4 nights (by using the formula ROUND(B1,0)-INT(A1) ). But it is giving 3 nights. How can I modify this formula? Pls help.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,033

    Re: Excel formula for calculating number of room nights

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Never use Merged Cells in Excel

  3. #3
    Registered User
    Join Date
    06-01-2015
    Location
    india
    MS-Off Ver
    Windows 7
    Posts
    15

    Re: Excel formula for calculating number of room nights

    Ok let me see if that works..Thanks a lot..will revert

  4. #4
    Registered User
    Join Date
    06-01-2015
    Location
    india
    MS-Off Ver
    Windows 7
    Posts
    15

    Re: Excel formula for calculating number of room nights

    It works in this particular case but if i use the same formula for a normal noon to noon stay then it is adding one day extra!

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

    Re: Excel formula for calculating number of room nights

    =int(b1)+(mod(b1,1)>time(13,0,0))-(int(a1)-(mod(a1,1)<time(11,0,0)))
    Samba

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

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,033

    Re: Excel formula for calculating number of room nights

    How about this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-01-2015
    Location
    india
    MS-Off Ver
    Windows 7
    Posts
    15

    Re: Excel formula for calculating number of room nights

    Thats perfect! tHANKS

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

    Re: Excel formula for calculating number of room nights

    pls mention for which post / member you are replying

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,033

    Re: Excel formula for calculating number of room nights

    Or this... (I look only noone above)...

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    11 and 13 represent hour of the day where you trying to make a new counting.

  10. #10
    Registered User
    Join Date
    06-01-2015
    Location
    india
    MS-Off Ver
    Windows 7
    Posts
    15

    Re: Excel formula for calculating number of room nights

    I meant Thanks nflsales. The formula works now. I will observe for a few bookings and let you know if any problems.

  11. #11
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Excel formula for calculating number of room nights

    nflsales formula didn't work for me, according to your description. Noon of one day to noon of the next day is technically 2 nights... by your description (I have no idea why others are using 11AM and 1PM, because it only results in one day).

    =INT(B1+12/24)-INT(A1-12/24) works in a technical fashion. Zbor was on the same track but instead of adding for the checkout time, he padded with the 1+, which gives the wrong result in some instances. If you want to pad the result for slightly early checkin or slightly late checkout the 12 in my formula represent hour of the day, as in Zbor's formula.

  12. #12
    Registered User
    Join Date
    06-01-2015
    Location
    india
    MS-Off Ver
    Windows 7
    Posts
    15

    Re: Excel formula for calculating number of room nights

    Hi jhren, in our system we charge once for noon to noon. So the nfsales is working fine for me. Anything before the checkin noon (For eg 0700 hrs to 1200 hrs) is charged as one day. Similarly anything after checkout noon (For eg 1500 hrs) is charged as an extra day.

    I guess I should use the words No of Charges instead of number of room nights.

  13. #13
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Excel formula for calculating number of room nights

    If that's the case, then =INT(B1+12/24)-INT(A1-7/24) would not charge the guest an extra night for checking in at 7-11:59AM... while it would for a guest for checking in at 6:59 or earlier.

  14. #14
    Registered User
    Join Date
    06-01-2015
    Location
    india
    MS-Off Ver
    Windows 7
    Posts
    15

    Post Re: Excel formula for calculating number of room nights

    I have another question. I have a column say of 10 cells say A1 to J1. I want a sum of only those cells which are showing a number value. I want to exclude the cells which are showing ####.

    Pls advise which formula to use?

  15. #15
    Registered User
    Join Date
    06-01-2015
    Location
    india
    MS-Off Ver
    Windows 7
    Posts
    15

    Re: Excel formula for calculating number of room nights

    Sorry I meant Cells A1 to A10. Also cells with negative values to be excluded. Need a total of cells with positive numbers only.
    Last edited by RAJIV5B; 06-02-2015 at 06:22 AM.

  16. #16
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Excel formula for calculating number of room nights

    Need two cells, for example B1 and B2. In B1 enter the number you want to exclude. In B2...
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    PS: Earlier I stated, "If you want to pad the result for slightly early checkin or slightly late checkout the 12 in my formula represent hour of the day..." To be more precise, it represent hours until next day for checkout time, and hours from previous day for check in time.

  17. #17
    Registered User
    Join Date
    01-02-2019
    Location
    Maldives
    MS-Off Ver
    Windows 10
    Posts
    1

    Re: Excel formula for calculating number of room nights

    Can someone please check my formula =SUM(IF(E2>=$B$2:$B$239, IF(E2<$C$2:$C$393, 1, 0), 0)) , I want to count the number of nights per date throughout the column.

    Sample:

    Column B Column C Column E
    Arrival Departure Date Allotment formula
    25-Jan-19 27-Jan-19 24-Jan-19 =SUM(IF(E2>=$B$2:$B$239, IF(E2<$C$2:$C$393, 1, 0), 0))
    27-Jan-19 29-Jan-19 25-Jan-19 =SUM(IF(E3>=$B$2:$B$239, IF(E3<$C$2:$C$393, 1, 0), 0))

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,387

    Re: Excel formula for calculating number of room nights

    Welcome to the forum!

    Unfortunately your post does not comply with Rule 4 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  19. #19
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Excel formula for calculating number of room nights

    see above post

  20. #20
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Excel formula for calculating number of room nights

    Try this

    =IF(AND(A1> 0,B1> 0),IF(MOD(A1,1)< TIMEVALUE("11:00"),1,0)+IF(MOD(B1,1)> TIMEVALUE("13:00"),1,0)+INT(B1)-INT(A1),"")
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add 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. [SOLVED] Need help with Index IF Match Formula. Returning Room Number that Matches the Hours Used
    By KattieSpencer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-25-2014, 12:22 PM
  2. [SOLVED] Formula to count number of nights falling in each month from arrival and departure dates
    By zicitron in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-28-2013, 02:16 AM
  3. link arrival and depature dates to the number of nights
    By angelviewxx in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-10-2013, 09:14 AM
  4. Replies: 6
    Last Post: 02-27-2013, 04:13 PM
  5. Calculating Weeks, Weekday nights and Weekend nights
    By bngguy in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-26-2010, 01:41 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