Calculate time

Excelexcel86

Board Regular
Joined
Feb 28, 2023
Messages
99
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Hi guys quick question how do I calculate time but only first 6 hours from two dates like so

02/03/2023 10:30 02/03/2023 15:30.

Obviously if I just minus the two cells I get 5 hours but I need it to stop calculating anything after 12:00 on the same day so it should be 1.30 hours

Any help be much appreciated
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi,
With your times in cells A1 and A2, you could test
Excel Formula:
=INT(A2)+MIN(0.5,MOD(A2,1))-A1
 
Upvote 0
Soemthing like this:
mr excel questions 12.xlsm
ABC
12023-02-03 10:3044960.4375<< Date/Time Value
22023-02-03 15:3044960.64583<< Date/Time Value
31900-01-00 01:30<<DIFFERENCE to 12 Noon
401:30:00<< As a time only
50.0625<< Date/Time Value
Sheet10
Cell Formulas
RangeFormula
B1:B2B1=A1
A3A3=IF(A2-INT(A2)>0.5,0.5,A2-INT(A2))-(A1-INT(A1))
A4A4=IF(A2-INT(A2)>0.5,0.5,A2-INT(A2))-(A1-INT(A1))
A5A5=IF(A2-INT(A2)>0.5,0.5,A2-INT(A2))-(A1-INT(A1))


MOD Function wlll work as well:
=IF(Mod(A2),1)>0.5,0.5,Mod(A2,1)-Mod(A1,1))
 
Upvote 0
Hi that part works great but I forgot to add that that some days hours are 8 hours worked
 
Upvote 0
Hi that part works great but I forgot to add that that some days hours are 8 hours worked
so, what is the RULE to subtract from noon instead of a different time? Do the hours ever go beyond midnight?
 
Upvote 0
you didn't answer the other part. how do I know to stop at 12 noon or keep going?
Is it if the hours difference is greater than 8? What if start in the afternoon.

I don't think you are giving enough information for someone to give an answer in one response. Please elaborate.
 
Upvote 0
please use the xl2bb add and mock up some start and end times and expected results. If cannot xl2bb then put the data in a table that we can copy, not an image.
 
Upvote 0
you didn't answer the other part. how do I know to stop at 12 noon or keep going?
Is it if the hours difference is greater than 8? What if start in the afternoon.

I don't think you are giving enough information for someone to give an answer in one response. Please elaborate.
 

Attachments

  • 56503CAB-D6F1-4987-8E14-CF877C32F108.png
    56503CAB-D6F1-4987-8E14-CF877C32F108.png
    251.2 KB · Views: 8
Upvote 0

Forum statistics

Threads
1,214,797
Messages
6,121,629
Members
449,041
Latest member
Postman24

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