simplifying an IF statement

Tucker92

Board Regular
Joined
Jun 7, 2018
Messages
53
I created an IF statement that is a bit extreme. I wanted to be able to account for break times between 10:15 and 10:30 and 1:00 to 1:30 and then at the end of the day start again basing it around how long something takes to do.

=IF(AND(A1>TIME(10,15,0),A1<TIME(10,30,0)),TIME(10,15,0)-(TIME(10,30,0)-A1),IF(AND(A1>TIME(13,0,0),A1<TIME(13,30,0)),TIME(13,0,0)-(TIME(13,30,0)-A1),IF(AND(A1>TIME(16,15,0),A1<TIME(7,30,0)),TIME(16,15,0)-(TIME(7,30,0)-A1),A1)))

Can anyone let me know if there is a more simple way to do this. It does work but I wanted to something similar on another spread sheet and was just wondering.

Thank you
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Sorry Only half of it actually appeared here it is in chunks

=IF(AND(A1>TIME(10,15,0),A1< TIME(10,30,0)),TIME(10,15,0)-(TIME(10,30,0)-A1)
,IF(AND(A1>TIME(13,0,0),A1< TIME(13,30,0)),TIME(13,0,0)-(TIME(13,30,0)-A1)
,IF(AND(A1>TIME(16,15,0),A1< TIME(7,30,0)),TIME(16,15,0)-(TIME(7,30,0)-A1),A1)))
 
Last edited by a moderator:
Upvote 0
There is a problem rendering to the forum when a < sign is followed immediately by a letter. I have fixed your second post by inserting a space between. :)
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,429
Members
448,961
Latest member
nzskater

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