Time Formula

kevinb11

Active Member
Joined
Feb 7, 2012
Messages
352
Need a Formula to figure the difference between time then round to nearest 15 minutes and change to number with a decimal point. Can it be done in one step or does it need to be multiple steps?
1654794110721.png


Tried =MOD(MROUND((B29-B28),"0:15"),1)
But I keep getting NUM! error

Thanks for any help you can provide
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
I am not getting a NUM error using the same data and same formula. Are your time values really time values, or are they text strings? The data is left-justified which suggests they are text.

Also in your sample data it looks like B29 is smaller than B28, unless you are omitting AM/PM from your formatting.

When you say you want a number with a decimal point, do you want this in units of hours?

It's always better to provide actual data vs. pictures.

In any case here is what I get with your data:
$scratch.xlsm
BCDE
288:00 AMTimeHours
291:00 PM5:005.00
Sprint
Cell Formulas
RangeFormula
D29D29=MOD(MROUND((B29-B28),"0:15"),1)
E29E29=D29*24


And here is a similar example to show the rounding working:
$scratch.xlsm
BCDE
288:00 AMTimeHours
291:13 PM5:155.25
Sprint
Cell Formulas
RangeFormula
D29D29=MOD(MROUND((B29-B28),"0:15"),1)
E29E29=D29*24
 
Upvote 0
Date and Time 2021.xlsm
ABCDE
1
208:00Hours
313:125.25
4
508:00
613:235.5
7
85:00 AM8:25 PM15.50
98:00 AM1:12 PM5.25
108:00 AM1:23 PM5.50
13b
Cell Formulas
RangeFormula
E3,E6E3=MROUND((B3-B2)*24,0.25)
D8:D10D8=MROUND((C8-B8)*24,0.25)
 
Upvote 0
I am not getting a NUM error using the same data and same formula. Are your time values really time values, or are they text strings? The data is left-justified which suggests they are text.

Also in your sample data it looks like B29 is smaller than B28, unless you are omitting AM/PM from your formatting.

When you say you want a number with a decimal point, do you want this in units of hours?

It's always better to provide actual data vs. pictures.

In any case here is what I get with your data:
$scratch.xlsm
BCDE
288:00 AMTimeHours
291:00 PM5:005.00
Sprint
Cell Formulas
RangeFormula
D29D29=MOD(MROUND((B29-B28),"0:15"),1)
E29E29=D29*24


And here is a similar example to show the rounding working:
$scratch.xlsm
BCDE
288:00 AMTimeHours
291:13 PM5:155.25
Sprint
Cell Formulas
RangeFormula
D29D29=MOD(MROUND((B29-B28),"0:15"),1)
E29E29=D29*24
They are set up as military time.
 
Upvote 0
Did you check post #3?
N.B. You can copy the post to a clean sheet. See the icon below the f(x) in the heading.

Date and Time 2021.xlsm
ABCDE
1
208:00Hours
301:007
4
513:23
608:005.5
7
8StartEnd
91:008:007.00
108:0013:125.25
118:0013:235.50
12
13b
Cell Formulas
RangeFormula
E3,E6E3=MROUND((B2-B3)*24,0.25)
D9:D11D9=MROUND((C9-B9)*24,0.25)
 
Upvote 0
Did you check post #3?
N.B. You can copy the post to a clean sheet. See the icon below the f(x) in the heading.

Date and Time 2021.xlsm
ABCDE
1
208:00Hours
301:007
4
513:23
608:005.5
7
8StartEnd
91:008:007.00
108:0013:125.25
118:0013:235.50
12
13b
Cell Formulas
RangeFormula
E3,E6E3=MROUND((B2-B3)*24,0.25)
D9:D11D9=MROUND((C9-B9)*24,0.25)
Formula works good since I changed time format to 1:00 PM, but throws a NUM! error when the last goes past midnight.

Sorry cannot upload a mini sheet due to using a company computer. I don't have permission. Thanks!
 
Upvote 0
A few examples with expected results would have helped.

Date and Time 2021.xlsm
BCD
8StartEnd
91:008:007.00
108:0013:125.25
118:0013:235.50
1210:0002:0016.00
1322:0002:004.00
1422:5303:004.00
1522:3104:005.50
13b
Cell Formulas
RangeFormula
D9:D15D9=MROUND(MOD(C9-B9,1)*24,0.25)
 
Upvote 0
Solution

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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