calculating time in a 24hour period midnight to midnight

LearningEX

Board Regular
Joined
Mar 13, 2015
Messages
208
i have a day that starts at 00:00 and finishes at 00:00, i need to abstract the time before starting work and time after work. so if i start work at 6am and finish work at 21:00 (9pm). so in reality that would be 6 hours after midnight and 3 hours before midnight giving a total of 9 hours rest. to add a twist to this is another issue if the time of rest is less than 11 hours i need a 9 to be displayed and if greater than 11.25 (11 hours 15 min) i need an 11 to be shown.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
how about something like
=IF((B2+(1-C2))<TIME(11,0,0),TIME(9,0,0),IF((B2+(1-C2))>TIME(11,15,0),TIME(11,0,0),(B2+(1-C2))))

what version of excel do you have ? worth updating profile as solutions may vary by excel version

Book3
ABCD
1StartEnd
26:0021:009:00
33:0023:009:00
46:0018:0011:00
56:0018:5011:10
Sheet1
Cell Formulas
RangeFormula
D2:D5D2=IF((B2+(1-C2))<TIME(11,0,0),TIME(9,0,0),IF((B2+(1-C2))>TIME(11,15,0),TIME(11,0,0),(B2+(1-C2))))


May need to add < = or a > = wasn't sure, if its exactly 11:15 - if thats still 11 or 11:15

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC , then put the sample spreadsheet onto a share
I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
 
Upvote 0
ill give it a try but may need to swap a few things around
 

Attachments

  • Capturetimeoff.JPG
    Capturetimeoff.JPG
    69.5 KB · Views: 27
Upvote 0
ok,
Also posting a small image
Note: Images are difficult to see , and also requires that I input all the data myself, which is very time consuming.

i have also answered you other similar question

which seems the same sort of question
 
Upvote 0
ok,
Also posting a small image
Note: Images are difficult to see , and also requires that I input all the data myself, which is very time consuming.

i have also answered you other similar question

which seems the same sort of question
lol i was not asking for you to put data in yourself, i was just showing you what i was doing thats all
 
Upvote 0
Assuming your end time is in column C and your start is in column B another option is
Excel Formula:
=IF(((C2-B2)*24)>=15,"9","11")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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