Time conversion to existing formula

psc1

New Member
Joined
Nov 27, 2011
Messages
32
Office Version
  1. 2010
Hi All
I got myself a headache trying to work this one out..
I am sure one of you experts out there will get me going ;)
2 cells to modify, I already have the hours but I need to show the minutes in actual time and not decimals but rounded to the nearest 15min.
Also, I need to add to a cell time from another cell but only if it goes beyond a value (132hrs) Then add the difference (whatever is above 132).
Please see attached document.
Many thanks

D&T Test.xlsx
ABCDEF
1
2Initial Date1/09/2023
3Initial Time7:00
41st Local Time Difference0
5Expected Date & Time (TU)6/09/2023 7:00
6Recommended Date & Time (TU)6/09/2023 7:00
7Actual Start Date (TU)6/09/2023
8Actual Start Time (TU)7:22
9Start Original Date & Time (TU)6/09/2023 7:22
10Hours Since Initial (120 +/-12hrs)120.3666667How to read decimal in minutes? Can it be rounded to the nearest 15 minutes?
112nd Local Time Difference0
12Expected Date & Time (V)12/09/2023 7:00
13Recommended Start Date & Time (V)12/09/2023 7:00
14Actual Start Date (V)12/09/2023
15Actual Start Time (V)7:12
16Start Time (V)12/09/2023 7:12
17Total Time from Initial (Min 264hrs)264.2How to read decimal in minutes? Can it be rounded to the nearest 15 minutes?
18Also, C17 needs to take into account additional hours IF C10 goes above 132hrs
19C17 must add hours from C10 ONLY if they are above 132
20
Sheet1
Cell Formulas
RangeFormula
C5C5=(C2+C3)+120/24
C6,C13C6=C5+(C4/24)
C9,C16C9=(C7+C8)-(C4/24)
C10C10=(C9-(C2+C3))*24
C12C12=(C2+C3)+264/24
C17C17=(C16-(C2+C3))*24
Cells with Data Validation
CellAllowCriteria
F3List=Sheet2!$B$4:$B$12
F6List=Sheet2!$B$4:$B$12
C4List=Sheet2!$B$2:$B$14
C11List=Sheet2!$B$2:$B$14
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
You can use the FLOOR function to truncate to 15 minute intervals. But, I'm not sure what you want regarding your adding C10 if over 132. Are you adding only the difference above 132 or all of it? You can also use custom formatting to display your hours and minutes.
Take a look:
Book1
ABCDE
1
2Initial Date2023-09-01
3Initial Time07:00:00
41st Local Time Difference0
5Expected Date & Time (TU)2023-09-06 07:00:00
6Recommended Date & Time (TU)2023-09-06 07:00:00
7Actual Start Date (TU)2023-09-06
8Actual Start Time (TU)07:22:00
9Start Original Date & Time (TU)2023-09-06 07:22:00
10Hours Since Initial (120 +/-12hrs)120.3666667120hr15minHow to read decimal in minutes? Can it be rounded to the nearest 15 minutes?
112nd Local Time Difference0custom format: [hh]"hr"mm[min]
12Expected Date & Time (V)2023-09-12 07:00:00
13Recommended Start Date & Time (V)2023-09-12 07:00:00
14Actual Start Date (V)2023-09-12
15Actual Start Time (V)07:12:00
16Start Time (V)2023-09-12 07:12:00
17Total Time from Initial (Min 264hrs)264.2264hr00minHow to read decimal in minutes? Can it be rounded to the nearest 15 minutes?
18Also, C17 needs to take into account additional hours IF C10 goes above 132hrs
19C17 must add hours from C10 ONLY if they are above 132
Sheet3
Cell Formulas
RangeFormula
C5C5=(C2+C3)+120/24
C6,C13C6=C5+(C4/24)
C9,C16C9=(C7+C8)-(C4/24)
C10C10=(C9-(C2+C3))*24
D10D10=FLOOR(C9-(C2+C3),15/(60*24))
C12C12=(C2+C3)+264/24
C17C17=(C16-(C2+C3))*24
D17D17=FLOOR(C16-(C2+C3),15/(60*24))+IF(D10>=(132/24),132/2,0)
 
Upvote 0
That is clever thanks for your help ;)
Regarding C17.. Yes anything above 132 from C10 is added to C17 (not all only >132)
I have no clue how to do this.. Is your current modification doing this?
 
Upvote 0
That is clever thanks for your help ;)
Regarding C17.. Yes anything above 132 from C10 is added to C17 (not all only >132)
I have no clue how to do this.. Is your current modification doing this?
It is not, change the formula to subtract the d10 value in the last part of the formula.
Something like this:


Excel Formula:
=FLOOR(C16-(C2+C3)+IF(D10>=(132/24),D10-132/24,0),15/(60*24))
(this is updated to apply the floor to the entire value).

Note I made my formula changes in column D, not C. You'll need to adjust accordingly.

Also, if you want to have the 15 minutes rounded up, use CEILING function instead of FLOOR.
 
Last edited:
Upvote 0
Great solution.
What sort of cell formatting you used to display result in Hours & Minutes "h:mm"?
I cannot get same results as you..
 
Upvote 0
I made some updates to my post in the last 4 minutes. You may need to reveiw them again.
The custom format is:
[hh]"hr"mm"min".
 
Upvote 0
Legend(y)
Thanks for this I got it now..
Quick question please:
Currently it rounds up to the lowest 15 min (i.e 28min on clock shows as15min)
Is there a different formula that combines Ceiling or Floor that could round to the nearest 15min.. Up or Down? (i.e 29min =30 & 12min = 15 or 6min =0)
Cheers
 
Upvote 0
Yes, just replace FLOOR with CEILING.
for cell D17:

Excel Formula:
=CEILING(C16-(C2+C3)+IF(D10>=(132/24),D10-132/24,0),15/(60*24))

As far as I know you can only choose one. You can't Floor at 22 minutes and Ceiling at 22 min 1 sec. Although there are probably some formula tricks that can coerce to the 15 minute interval you want.
 
Last edited:
Upvote 0
Just did but now it is rounding up :)
I meant if time is 07:06am it should show 07:00 but if Time is 07:09, it should read 07:15 (nearest 15 minutes either up or down based on exact clock)
Cheers
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

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