Excel Formula Help

t_bannigan

New Member
Joined
Feb 6, 2023
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I need a formula to calculate the following:

1675693858113.png

The above times are times people are clocking in and out on one of my sites. I need a formula that will show the elapsed time outside the site hours e.g The site hours are 7:30-16:30, if I take the top row, they are showing as working 27 minutes over the site hours this will need to be deducted as I cannot put this forward to the client.
I was wondering if there is a formula out there that can help with this rather than having to go through every time individually and working it out!

Thanks in advance for any help!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I see, it states 365 on your about info so i made it for that, may not work in 2019
 
Upvote 0
U can try this

Excel Formula:
=IF(REPLACE(A1,1,SEARCH(" ",A1),"")+0 > TIME(16,30,0),REPLACE(A1,1,SEARCH(" ",A1),"")+0 - TIME(16,30,0))+IF(REPLACE(A1,SEARCH(" ",A1),95,"")+0 < TIME(7,30,0),TIME(7,30,0)-REPLACE(A1,SEARCH(" ",A1),95,"")+0 )
 

Attachments

  • 1675702060945.png
    1675702060945.png
    28 KB · Views: 6
Upvote 0
Solution
U can try this

Excel Formula:
=IF(REPLACE(A1,1,SEARCH(" ",A1),"")+0 > TIME(16,30,0),REPLACE(A1,1,SEARCH(" ",A1),"")+0 - TIME(16,30,0))+IF(REPLACE(A1,SEARCH(" ",A1),95,"")+0 < TIME(7,30,0),TIME(7,30,0)-REPLACE(A1,SEARCH(" ",A1),95,"")+0 )
Thank you for this. It works!
 
Upvote 0
In future please mark the post that contains the solution as the solution, instead of your feedback message as it will help future readers. No further action is required for this thread.

Also if you are using 2019 as per post#11 please change your profile to show this.
Thanks
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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