Array Sum Room Nights

ricafonyat

New Member
Joined
May 1, 2017
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hello!!

I am looking for help to build an array formula that compute by month and year the number of room nights according the hotel reservations book


Hotel Reservations
Check-in DateCheck-out DateRoom Nights
Apr.30.2017May.02.2017 2
May.01.2017May.02.2017 1
May.03.2017May.06.2017 3
May.10.2017May.11.2017 1
May.12.2017May.15.2017 3
May.30.2017Jun.02.2017 3
Jun.03.2017Jun.05.2017 2
Jun.30.2017Jul.01.2017 1
Jul.02.2017Jul.05.2017 3
Jul.06.2017Jul.10.2017 4
Jul.15.2017Jul.22.2017 7
Jul.25.2017Aug.01.2017 7
Total Room Nights 37

<colgroup><col><col><col></colgroup><tbody>
</tbody>

MonthRoom Nights
Jan.17 ?
Feb.17 ?
Mar.17 ?
Apr.17 ?
May.17 ?
Jun.17 ?
Jul.17 ?
Aug.17 ?
Sep.17 ?
Oct.17 ?
Nov.17 ?
Dec.17 ?
Total Room Nights 37

<colgroup><col><col></colgroup><tbody>
</tbody>

Any help would be appreciated
Rica
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try

Dates, numbers not text, in columns A:B as dd/mm/yyyy
Months, numbers not text, in E2:E13
Some abbreviations of the months in Portuguese are different from English but very similar (fev instead of feb, abr instead of apr, etc...)


A
B
C
D
E
F
1
Check-in Date​
Check-out Date​
Room Nights​
Month​
Room Nights​
2
30/04/2017​
02/05/2017​
2​
jan/17​
0​
3
01/05/2017​
02/05/2017​
1​
fev/17​
0​
4
03/05/2017​
06/05/2017​
3​
mar/17​
0​
5
10/05/2017​
11/05/2017​
1​
abr/17​
1​
6
12/05/2017​
15/05/2017​
3​
mai/17​
11​
7
30/05/2017​
02/06/2017​
3​
jun/17​
4​
8
03/06/2017​
05/06/2017​
2​
jul/17​
21​
9
30/06/2017​
01/07/2017​
1​
ago/17​
0​
10
02/07/2017​
05/07/2017​
3​
set/17​
0​
11
06/07/2017​
10/07/2017​
4​
out/17​
0​
12
15/07/2017​
22/07/2017​
7​
nov/17​
0​
13
25/07/2017​
01/08/2017​
7​
dez/17​
0​
14
Total Room Nights​
37​
Total Room Nights​
37​

Array formula in F2 copied down (gray area)
=SUM(IF(1-((A$2:A$13>EOMONTH(E2,0))+(E2>B$2:B$13)),IF(B$2:B$13>EOMONTH(E2,0),1+EOMONTH(E2,0),B$2:B$13)-IF(A$2:A$13>E2,A$2:A$13,E2)))
Ctrl+Shift+Enter

M.
 
Upvote 0
Thanks Marcelo!
It works perfectly!
Are you from Brasil?
Best Regards
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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