Formula Help Needed!

Bostockm

New Member
Joined
Nov 20, 2014
Messages
9
Hi,

I'm in need of a bit of help developing a formula...

I currently use the following formula to calculate hours worked on a timesheet:

Code:
=IF(AND(OR(B8="Mon",B8="Tue",B8="Wed",B8="Thu",B8="Fri"),N8=""),IF(((E8-D8+(E8<D8))+(G8-F8+(G8<F8))+(I8-H8+(I8<H8)))*24>8,8,((E8-D8+(E8<D8))+(G8-F8+(G8<F8))+(I8-H8+(I8<H8)))*24),0)

Basically, the code works out whether it's a Monday-Friday (in column B) or whether it's a weekend. It then adds up the hours worked, and enters the total up to 8 hours.

I'd like users to be able to enter 'Annual Leave' in their day's description (Column C), and then the above code would automatically enter the number 8. I'm thinking something like
Code:
IF(C8="Annual Leave",8,0)
.

I can't work out where in the formula I'd need to put this code to make it work?! Ideally I'd like it to only do this if it's a Monday-Friday.

All help gratefully received!

Many thanks.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try to put a pair of space round a < sign when you post a formula.

Sorry, it should be:

Code:
=IF(AND(OR(B8="Mon",B8="Tue",B8="Wed",B8="Thu",B8="Fri"),N8=""),IF(((E8-D8+(E8 < D8))+(G8-F8+(G8 < F8))+(I8-H8+(I8 < H8)))*24 > 8,8,((E8-D8+(E8 < D8))+(G8-F8+(G8 < F8))+(I8-H8+(I8 < H8)))*24),0)
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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