Subtracting time

Caribeiro77

Well-known Member
Joined
Sep 24, 2010
Messages
1,261
Hy guys i want subtract the following:

7:00PM
11:00PM

Is easy to know the result in this case, i just have to subtract the later hour by the earlier and i have the result of 4.
But what i want to know how is how to subtract time only after 10:00PM, in this case the result would be 1 hour, i just don´t know how to get it..

Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
There are a couple of ways:

=A2-"10:00 PM"

or

=A2-22/24

(since 10pm is 22 hours out of 24)
 
Upvote 0
Hy guys i want subtract the following:

7:00PM
11:00PM

Is easy to know the result in this case, i just have to subtract the later hour by the earlier and i have the result of 4.
But what i want to know how is how to subtract time only after 10:00PM, in this case the result would be 1 hour, i just don´t know how to get it..

Thanks
Try this...

=MOD(B1-IF(A1 < TIME(22,0,0),TIME(22,0,0),A1),1)*24<TIME(22,0,0),TIME(22,0,0),A1),1)*24< p>

Format as General or Number
 
Upvote 0
Looks like you have received a number of answers, but I will add mine too.
Excel Workbook
AB
17:00 PM11:00 PM
211:00 PM1:00 AM
34:002:00
Sheet
 
Upvote 0
Datsmart, the op only wanted to count time after 11:00 PM.

Which of course begs the question, when does the op consider after 10 PM to stop?
 
Upvote 0
Thanks Valko, i just had to eliminate the last part of the formula "*24" and it's perfect...
thanks once again


Try this...

=MOD(B1-IF(A1 < TIME(22,0,0),TIME(22,0,0),A1),1)*24<TIME(22,0,0),TIME(22,0,0),A1),1)*24< p>

Format as General or Number
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

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