Formula for time after 5pm

josullivan601632

New Member
Joined
Aug 23, 2020
Messages
39
Office Version
  1. 2007
Platform
  1. Windows
Hi all

I am looking for some help with a formula to work out number of hours after 5pm.

I have a start and end time, which is formatted in time, from this I can work out hours worked, but I would like to add a formula into another column that recognises time being after 5pm and then adds the hours after 5pm, this can be done over a couple of columns but I can't work it out how to do it!

Any help would be greatly appreciated!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Maybe something like these:
Book2
ABCDEFGH
1
2StartEndhh:mmdecimalhh:mm before 5pdec before 5phh:mm after 5pdecimal after 5p
310:30:0016:00:0005:30:005.5005:30:005.500000nana
410:30:0017:00:0006:30:006.5006:30:006.500000nana
510:30:0018:45:0008:15:008.2506:30:006.50000001:45:001.75
Sheet1
Cell Formulas
RangeFormula
C3:C5C3=B3-A3
D3:D5D3=VALUE(B3-A3)*24
E3:E5E3=IF(TIME(17,0,0)>B3,B3,TIME(17,0,0))-A3
F3:F5F3=24*(IF(TIME(17,0,0)>B3,B3,TIME(17,0,0))-A3)
G3:G5G3=IF(B3<=TIME(17,0,0),"na",(B3-TIME(17,0,0)))
H3:H5H3=IF(B3<=TIME(17,0,0),"na",24*VALUE((B3-TIME(17,0,0))))
 
Last edited:
Upvote 0
See if this works for you.
Note: (17/24) in the formula is just the decimal form of 5:00 pm. {5:00 pm = 0.708333)
Column C is formatted as [H]:mm

Book1
ABC
1StartEndHours After 5 pm
210:00 AM3:00 PM0:00
310:00 AM6:00 PM1:00
46:00 PM9:30 PM3:30
58:45 PM11:25 PM2:40
65:00 PM10:25 PM5:25
77:00 AM5:00 PM0:00
87:00 AM6:25 PM1:25
92:00 AM7:10 PM2:10
102:00 PM5:30 PM0:30
114:45 PM5:16 PM0:16
124:00 PM4:10 PM0:00
135:00 PM5:02 PM0:02
Sheet1
Cell Formulas
RangeFormula
C2:C13C2=MEDIAN(0,B2-(17/24),B2-A2)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

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