# # days in a certain month between any two dates

1. ## # days in a certain month between any two dates

Hi there,

If I have the start date of 29/7/2013 and end date of 3/8/2013 and need the output to be July = 2 and August = 3, is there a formula that will achieve this?

Sheet attached. Output cells are in orange under the month number

Kind regards,

MQ

2. ## Re: # days in a certain month between any two dates

for the first part (july) Eomonth(startdate)-startdate gives days left in the month of july,(2) and day(enddate) will give your 3, although day(enddate)-1 is really the actual days between,then we have the issue of if the months are not consecutive...is there a limit on the size of the spread between the 2 dates?

3. ## Re: # days in a certain month between any two dates

hi MQ. why is C2 2? 29 Jul, 30 Jul, 31 Jul. 3 days? if you want to exclude the start date, then C3 should be 12? to get 3 days, you can try in C2:
=SUMPRODUCT(--(MONTH(ROW(INDIRECT(\$A2&":"&\$B2)))=C\$1))

don't understand how you got 12 for C6, 5 for N4, 4 for L7. maybe you can explain those. to hide the zeroes, you can format the cells as:
General;;

4. ## Re: # days in a certain month between any two dates

Originally Posted by dredwolf
for the first part (july) Eomonth(startdate)-startdate gives days left in the month of july,(2) and day(enddate) will give your 3, although day(enddate)-1 is really the actual days between,then we have the issue of if the months are not consecutive...is there a limit on the size of the spread between the 2 dates?
No limit between the dates, could span over many months as they are employee leave start and end dates. Not likely an employee would be be away for an entire year unless its a special circumstance.

5. ## Re: # days in a certain month between any two dates

Originally Posted by benishiryo
hi MQ. why is C2 2? 29 Jul, 30 Jul, 31 Jul. 3 days?
Yep, sorry about that, put that sheet together a little too quick..

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1