Find number of days in a date range but only for a specific Month

Aviles

Board Regular
Joined
Dec 17, 2008
Messages
163
Hi all,

I'm looking for a formula to find the number of days within a date range, but only for a specific month (in this case, July):

Start DateEnd DateExpected
Result (days)
28/06/201927/08/201931
15/07/201915/10/201917
01/03/201910/07/201910

<tbody>
</tbody>

In this instance I'm only looking for the number of days in July, but this will change and I would like to easily change the formula to suit other months.

Thanks in advance.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try My Array formula (Ctrl+Shift+Enter)
supposing that your data in cells a1 and b1
Code:
=SUMPRODUCT(IF(MONTH(ROW(INDIRECT(A1&":"&B1)))=7,1,0))
 
Last edited:
Upvote 0
For a non-volatile option, you could try this.

Change A1 for a different month.

Excel Workbook
ABC
1July
2
3Start DateEnd DateResult (days)
428/06/201927/08/201931
515/07/201915/10/201917
61/03/201910/07/201910
Days
 
Last edited:
Upvote 0
.. or for a non-volatile version of the post 2 formula, and also using a single cell to change the month-of-interest, you could try this.
Note that this also does not require the Control+Shift+Enter confirmation.

Excel Workbook
ABC
1June
2
3Start DateEnd DateResult (days)
428/06/201927/08/20193
515/07/201915/10/20190
61/03/201910/07/201930
Days (2)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,382
Members
448,889
Latest member
TS_711

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