# 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!

1,082,166
Messages
5,363,521
Members
400,747
Latest member
monty_gl

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...