# Elapsed Time Minus Holidays

#### kod2th3e

##### Board Regular
I would like to calculate the difference in time between two dates. Assuming that my company works 24/7 I would like to calculate the difference between an "IN" date/time and "FINISH" date/time skipping over any days that may be in a list of holidays.

So, if in cell A1 I have 9/11/2009 9:23 AM ("IN" date/time) and in cell B1 I have 9/14/2009 9:23 AM ("FINISH" date/time) and I have dates 9/12/2009, 9/15/2009, & 9/19/2009 in H1:H3 ("holiday list") then, I would like Cell C1 to display 48:00:00 because 9/12/2009 is in a list of holidays to skip over.

Otherwise. if 9/12/2009 wasn't in the list of holidays it should read 72:00:00.

If anyone could help with this, that'd be awesome, thanks for your time in viewing.

### Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

#### TFCJamieFay

##### Active Member
Hi,

Try:

Code:
``=SUM(C2-C1)-COUNTA(HolidayList)``

Where "HolidayList" is a named range containing your holidays, C1 is you start date and time and C2 is your end date and time.

HTH,

Jay

#### kod2th3e

##### Board Regular
I get a negative number when this is done, so the cell that this formula is in displays a whole bunch of pound (#) signs.

#### Andrew Poulsom

##### MrExcel MVP
Try:

=(B1-A1)-SUMPRODUCT(--(COUNTIF(H1:H3,ROW(INDIRECT(INT(A1)+1&":"&INT(B1))))<>0))

#### kod2th3e

##### Board Regular
Thank you, works perfectly.

Thanks,
-Cody

Replies
5
Views
428
Replies
3
Views
167
Replies
4
Views
570
Replies
3
Views
443
Replies
3
Views
280

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,151,844
Messages
5,766,744
Members
425,378
Latest member
kapoor2892

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

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