Using SUMIFS to calculate occupancy on a given day when start + end dates + # of occupants known

lavetta

New Member
Joined
Sep 12, 2014
Messages
2
Hi,

I need some help with the SUMIFS function (or alternative if that is better suited).

I have a spreadsheet that contains holiday booking information, and I would like to calculate how many people are present on a given day.

I have three columns of data:


  • Column A = number of occupants in a booking (i.e. this is the number to be summed if the conditions are met)
  • Column B = start date of booking
  • Column C = end date of booking

We can consider that Column D = date on which I want to calculate the occupancy (essentially I want to have a column with all the days in a year - e.g. D1 = Jan 1st, D2 = Jan 2nd...).

In plain English, I want to SUM the number of occupants (Column A) on a given date (Column D). The occupants will be summed IF the chosen date (Column D) is equal to or more than the start date of the booking (Column B) AND is less than the end date of the booking (Column C) - i.e. our chosen date in Column D must be between the dates in Columns B and C.

Currently I have the following formula which gives a "0" result:

=SUMIFS($A$2:$A$668, $B$2:$B$668, ">=" & D2, $C$2:$C$668, "<=" & D2)


Any help on the syntax would be greatly appreciated!!!


It would also be useful to have a similar formula that counts the number of arrivals on a given day - at the moment I can only get it to SUM the number of occupants (i.e. I can't get COUNTIF to work... I guess one alternative would be add a single column with "1" in each cell):

=SUMIFS($A$2:$A$668, $B$2:$B$668, ">=" & D5, $B$2:$B$668, "<=" & D5)


I am using Excel 2011 on Mac.

Many Thanks!!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

engineer69

New Member
Joined
Apr 3, 2009
Messages
34
I preferr to use the "SUMPRODUCT" function. It seems to be a little more straight forward.
 

lavetta

New Member
Joined
Sep 12, 2014
Messages
2
I preferr to use the "SUMPRODUCT" function. It seems to be a little more straight forward.

Thanks for the reply engineer69, unfortunately it's not working as the result is still coming out as "0".

I tried this formula:

=SUMPRODUCT(($A$2:$A$668)*($B$2:$B$668>=D6)*($C$2:$C$668<=D6))
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,487
Messages
5,831,987
Members
430,100
Latest member
namhnz

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
Top