Calculate monthly booked percentage of hotel rooms

arendberg

New Member
Joined
Jan 23, 2024
Messages
21
Office Version
  1. 365
Platform
  1. MacOS
Hey all,

I have a very big Excel file with all our hotel reservations in it. Column A has arrival dates, Column B has departure dates and Column C has the Room name. Every row shows 1 reservation.
In another sheet I would like to show per month the percentage of nights that have been reserved. So I input the Room name in this new sheet in N1 and for every month I will get a percentage showing how many nights have been booked in that month.

So if you take Room 1 for January 2025 you can see that it has been booked for 7 nights. So sheet 2 should show me a percentage of 21.6%. January has 31 possible nights that can be booked, 7 / 31 * 100.

I have tried a lot of things but so far have not been able to get the correct formula.

Hopefully someone here is able to help, thanks in advance!!

Example.xlsx
ABC
1ArrivalDepartureRoom
25/1/245/3/24Room 2
35/1/245/4/24Room 1
45/9/245/20/24Room 2
55/12/245/17/24Room 1
65/27/245/29/24Room 2
76/4/246/7/24Room 2
86/6/246/9/24Room 1
96/7/246/11/24Room 2
106/12/246/16/24Room 2
116/14/246/18/24Room 1
126/20/246/23/24Room 2
136/21/246/23/24Room 1
146/23/246/25/24Room 1
156/23/246/25/24Room 2
166/25/246/30/24Room 1
176/29/248/27/24Room 2
187/5/247/9/24Room 1
197/14/247/19/24Room 1
207/23/247/26/24Room 1
217/29/248/4/24Room 1
228/9/248/12/24Room 1
238/12/248/15/24Room 1
248/16/248/18/24Room 1
258/18/248/22/24Room 1
268/25/248/29/24Room 1
278/29/248/31/24Room 2
288/29/249/1/24Room 1
298/31/249/3/24Room 2
309/3/249/7/24Room 2
319/4/249/6/24Room 1
329/8/249/11/24Room 2
339/16/249/20/24Room 2
349/17/249/22/24Room 1
3510/2/2410/4/24Room 1
3610/2/2410/5/24Room 2
3710/6/2410/7/24Room 1
3810/6/2410/10/24Room 2
3910/13/2410/17/24Room 2
4010/21/2410/25/24Room 2
4110/21/2410/27/24Room 1
4210/29/2411/10/24Room 1
4310/30/2411/1/24Room 2
4411/1/2411/3/24Room 2
4511/4/2411/8/24Room 2
4611/8/2411/10/24Room 2
4711/15/2411/17/24Room 1
4811/20/2411/24/24Room 1
4911/22/2411/24/24Room 2
5011/28/2411/29/24Room 1
5112/5/2412/7/24Room 2
5212/7/2412/9/24Room 1
5312/11/2412/14/24Room 1
5412/14/2412/16/24Room 2
5512/19/2412/22/24Room 2
5612/20/2412/22/24Room 1
5712/23/2412/27/24Room 2
5812/23/2412/27/24Room 1
5912/27/2412/30/24Room 1
6012/27/2412/30/24Room 2
6112/30/241/4/25Room 2
6212/31/241/4/25Room 1
631/17/251/19/25Room 1
641/18/251/25/25Room 2
651/19/251/24/25Room 1
661/25/252/1/25Room 2
672/14/252/21/25Room 2
682/20/252/25/25Room 1
692/21/253/1/25Room 2
703/10/253/15/25Room 1
713/17/253/20/25Room 1
723/17/253/23/25Room 2
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
2:72Expression=#REF!<>""textYES


Example.xlsx
ABCDEFGHIJKLMN
1May-24Jun-24Jul-24Aug-24Sep-24Oct-24Nov-24Dec-24Jan-25Feb-25Mar-25Apr-25Room 1
2Formula that shows 22,6%
Sheet2
 
Ah I understand what you mean but we always look at nights not days. So the last night in any month should always be counted. So in this case from 28-2 to 01-03 is also a valid night for february.

Does that make sense?
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hm.. try:
Excel Formula:
=LET(
arrival,$A$2:$A$5,
depart,$B$2:$B$5,
SUM(FILTER(IF(depart=EOMONTH(+arrival,0)+1,depart,IF(depart>EOMONTH(+arrival,0),EOMONTH(+arrival,0),depart))-arrival,($C$2:$C$5=$S$1)*(EOMONTH(+arrival,-1)+1=F2)*($D$2:$D$5=""),0))/DAY(EOMONTH(F2,0))
)
 
Upvote 0
Ok so now that February month is correct but another month has this row:

01/11/202421/12/2024

So it should also show as 100% but it is showing 96,7%?

Sorry.... But it seems you are almost there!
 
Upvote 0
I think this should do it. Adjust the range.

Excel Formula:
=LET(
arrival,$A$2:$A$5,
depart,$B$2:$B$5,
e,EOMONTH(+arrival,0),
SUM(FILTER(IF(depart=e+1,depart,IF(depart>e,e+1,depart))-arrival,($C$2:$C$5=$S$1)*(EOMONTH(+arrival,-1)+1=F2)*($D$2:$D$5=""),0))/DAY(EOMONTH(F2,0))
)
 
Upvote 0
Yes that fixed november but now december is incorrect, so sorry!

These are the lines with december 2024 reservations.

01/11/2024 21/12/2024
21/12/2024 28/12/2024
28/12/2024 04/01/2025


It looks like your formula doesn't take into account the december nights that are part of the reservation that started in november? I now have 35.5% for december while it should be 100%.
And the same goes for january 2025, there are 3 nights in the last december booking that are not calculated in January.
 
Upvote 0
I have a better idea of what you want but I have to think how to execute it in version 2021.
 
Upvote 0
Try this:
Excel Formula:
=LET(a,$A$2:$A$76,b,$B$2:$B$76,em,EOMONTH(F2,0),e,IF(b>em,em+1,b)-IF(a<F2,F2,a),SUM(($C$2:$C$76=$S$1)*($D$2:$D$76="")*IF(e<0,0,e))/DAY(em))
 
Upvote 0
Thank you for all your help, really appreciate it! So far I haven't found any problems with your latest solution.
 
Upvote 0
I hope you can help me with one final solution that would make this formula even better for our setup.

We have another column, E, with the date a reservation has been created. I would like to add a function to the formula that takes my input date and only looks at reservations made before that input date.
So in this example the date that is given in Sheet 2 P1 should make the formula take only the nights that have a creation date in Sheet 1 Column E before 01/12/2024.

Example.xlsx
ABCDE
1ArrivalDepartureRoomCancelled OnCreated On
22/1/252/8/25Room 11/1/24
32/8/252/15/25Room 11/2/24
42/15/252/22/25Room 11/3/24
52/22/253/1/25Room 11/4/24
65/27/245/29/24Room 21/5/24
76/4/246/7/24Room 21/6/24
86/6/246/9/24Room 11/7/24
96/7/246/11/24Room 21/8/24
106/12/246/16/24Room 24/10/241/9/24
116/14/246/18/24Room 11/10/24
126/20/246/23/24Room 21/11/24
136/21/246/23/24Room 11/12/24
146/23/246/25/24Room 11/13/24
156/23/246/25/24Room 21/14/24
166/25/246/30/24Room 11/15/24
176/29/248/27/24Room 21/16/24
187/5/247/9/24Room 11/17/24
197/14/247/19/24Room 11/18/24
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
20:72,C2:XFD2,C3:D5,A6:D19,E3:XFD19Expression=#REF!<>""textYES


Example.xlsx
ABCDEFGHIJKLMNOP
1May-24Jun-24Jul-24Aug-24Sep-24Oct-24Nov-24Dec-24Jan-25Feb-25Mar-25Apr-25Room 112/1/24
20.0%53.3%45.2%58.1%23.3%35.5%23.3%45.2%22.6%114.3%25.8%0.0%
Sheet2
Cell Formulas
RangeFormula
A2:L2A2=LET(arrival,Sheet1!$A$2:$A$72,depart,Sheet1!$B$2:$B$72,room,A1,SUM(FILTER(IF(depart>EOMONTH(+arrival,0),EOMONTH(+arrival,0),depart)-arrival,(Sheet1!$C$2:$C$72=$N$1)*(EOMONTH(+arrival,-1)+1=room),0))/DAY(EOMONTH(room,0)))
 
Upvote 0
Don't mind the wrong formula in this example, I haven't updated it with your last version. Oh and I use the latest MacOS version of Excel, so not 2021 but 365. Not sure if this helps you in any way?
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,172
Members
452,893
Latest member
denay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top