Formula to count days in array based on criteria within a specific month

Dman333

Board Regular
Joined
Sep 30, 2016
Messages
52
Office Version
  1. 365
Platform
  1. Windows
Does anyone know if there is a method or function in excel that will total all the days in April and May separately? I have a large data set and calculate occupancy within a specific date range based on multiple criteria (using sumifs). Now I want to calculate the occupancy by month within that date range which could be 1 month or 1 year. A small example of a data set is below:

ArriveDepartTotal_Days
4/2/20164/24/201621
4/4/20164/27/201622
4/6/20164/30/201623
4/8/20165/3/201624
4/10/20165/5/201624
3/27/20164/1/20164
3/29/20164/3/20164
3/31/20164/6/20165
4/2/20164/10/20167

<tbody>
</tbody>
 

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

Excel 2010
BCDEFGHI
1
2ArriveDepartTotal_Days01-03-1601-04-1601-05-1601-06-16
32-Apr-1624-Apr-16230230
44-Apr-1627-Apr-16240240
56-Apr-1630-Apr-16250250
68-Apr-163-May-16260233
710-Apr-165-May-16260215
827-Mar-161-Apr-166510
929-Mar-163-Apr-166330
1031-Mar-166-Apr-167160
112-Apr-1610-Apr-169090
1215291358
1d
Cell Formulas
RangeFormula
E3=C3-B3+1
F3=MAX(0,MIN(G$2,$C3+1)-MAX(F$2,$B3))
G3=MAX(0,MIN(H$2,$C3+1)-MAX(G$2,$B3))
H3=MAX(0,MIN(I$2,$C3+1)-MAX(H$2,$B3))


N.B.
copy the formula down
sum the columns
This suggestion includes both the Start Date and the End Date
 
Last edited:
Upvote 0
Thanks - That works well though I was hoping to have a single cell for the formula and not have to add a bunch of columns to the worksheet because I'm just looking for the summary data. I don't think excel has a single function that will do this.
Thanks for the help!
 
Upvote 0

Forum statistics

Threads
1,216,444
Messages
6,130,659
Members
449,585
Latest member
Nattarinee

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