# Date difference excluding days of week

#### Quarius

##### New Member
Hi,

I have two dates, the start date and the end date. I need to calculate the exact date difference between them but excluding specific days of week. For example:

Start date: 2015-10-06 11:00 AM
End date: 2015-10-29 18:55 PM

And all of Wednesdays and Fridays need to be excluded (Start date and End date cannot occur in the excluded days).

How to achieve such thing without VBA using Excel 2007?

#### Eric W

##### MrExcel MVP
Welcome to the MrExcel forum!

Kind of tricky, but I think this works:

<weekday(l10,13),1,0)-if(weekday(l11,15)<weekday(l10,15),1,0)
<weekday(l10,13),1,0)-if(weekday(l11,15)<weekday(l10,15),1,0)
=DATEDIF(L10,L11,"d")-2*INT(DATEDIF(L10,L11,"d")/7)-IF(WEEKDAY(L11,13) < WEEKDAY(L10,13),1,0)-IF(WEEKDAY(L11,15) < WEEKDAY(L10,15),1,0)

Where the start date is in L10 and the end date is in L11. I've tested it and it seems to work for me. Try it and see if it meets your needs and let me know.</weekday(l10,13),1,0)-if(weekday(l11,15)<weekday(l10,15),1,0)
</weekday(l10,13),1,0)-if(weekday(l11,15)<weekday(l10,15),1,0)

#### Quarius

##### New Member
Hello Eric!

Thanks for the response. Unfortunately, in the Excel 2007 WEEKDAY doesn't support parameters 11-17 (Look here).

But I've managed to create a solution based partially on this post.

Assuming the start date is in A1 and the end date is in B1 and I want to exclude (for example) Wednesdays and Fridays, the formula looks like this:

Code:
``=B1-A1-(INT((WEEKDAY(A1-3,2)-A1+B1)/7)+INT((WEEKDAY(A1-5,2)-A1+B1)/7))``

#### Eric W

##### MrExcel MVP
It is tricky trying to keep track of what version supports what options.

I am glad you figured it out though. Well done!