Adding time if a cell falls between a certain time interval

sbrain

New Member
Joined
Mar 28, 2011
Messages
2
I know the formula for adding time which is:
+TIME (hours, minutes, seconds).

I need to know the formula/code to add TIME to a cell if the cell passes through a fixed time.

For example:

If cell A1 is 9:00AM and cell A2 is 5:00PM, how do I add 15 minutes to 5:00 to make it 5:15PM without having to manually add it everytime? The 15 minutes would be a break during the working shift.
But if cell A1 is 8:00AM and cell A2 is 10:00AM I would not want to add the 15 minutes.


Any help would be appreciated. Thanks!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Why does 9-5 gets a break and 8-10 doesn't? Is it because the difference between the times has exceeded a certain amount (like four hours, for example) or is it because the period in question goes through a particular time like midday? <!-- / message --><!-- sig -->
 
Upvote 0
You don't say what the 'fixed time' is but assuming it's midday, try this in cell C1:-
Code:
=IF(AND(A1<TIME([COLOR=blue][B]12[/B][/COLOR],0,0),B1>TIME([B][COLOR=blue]12[/COLOR][/B],0,0)),B1+TIME(0,15,0),B1)
 
Upvote 0
How do I add 15 minutes to the time when the time passes through 9AM? I need the cell to add a certain amount of time when passed through a certain time.
 
Upvote 0
Sorry, I coded a < in my previous post and the forum software got its knickers in a twist.

Put this in C1:-
Code:
=IF(AND(A1<TIME(9,0,0),B1>TIME(9,0,0)),B1+TIME(0,15,0),B1)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,958
Messages
6,122,475
Members
449,087
Latest member
RExcelSearch

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