time equation

HappyChappy

Active Member
Joined
Jan 26, 2013
Messages
378
Office Version
  1. 2019
  2. 2010
  3. 2007
Platform
  1. Windows
i have 50:00 in cell c1 3:35 in c2 when i put c1-c2 i get 04:48 i should be getting 46:25 cant seem to figure it out sure there is a simple reason its not returning the correct figure
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
How is each cell formatted?
Can you convert to General and see if the arithmetic looks correct.
How did you enter the time values (manually or by TIME() formula)?

Posting a mini sheet of your data could be helpful.

This is what I have:


Book1
ABCDEF
150:00:0000:50:0000:50:0050:00:00
203:35:0000:03:3503:35:0000:03:35
346:25:000:46:25###############49:56:25
Sheet2
Cell Formulas
RangeFormula
C3:F3C3=C1-C2
 
Upvote 0
Payslip.xlsx
ABCDEFGHIJKLMNOPQRSTU
1DayDateStart TimeFinish TimeRounded Time to nearest 15 MinRounded Time to nearest 15 MinHours workedTotal_45 BreakBasic HoursBasic + ServicingBasic Hours + BreaksOvertime Paid at Std RateServicingbreakHours @ OvertimeBonusover timeFuel Mileage
2Days Hours
3Monday05/02/202407:0017:0007:0017:0010:009:158:008:308:450:57131.750:300:450:451:15£12.2522.0920.00
4Tuesday06/02/202407:0017:0007:0017:0010:009:158:008:308:450:57131.750:300:450:451:15£12.2522.0920.00
5Wednesday07/02/202407:0017:0007:0017:0010:009:158:008:308:450:57131.750:300:450:451:15£12.2522.0920.00
6Thursday08/02/202407:0017:0007:0017:0010:009:158:008:308:450:57131.750:300:450:451:15£12.2522.0920.00
7Friday09/02/202407:0017:0007:0017:0010:009:157:007:308:450:57116.250.040:300:450:452:15£12.2522.0920.00
8Saturday10/02/202400:0000:000:000:000:000:000:000.000:000:000:00£0.000.00
9Sunday11/02/202400:0000:000:000:000:000:000:000.000:000:000:00£0.000.00
102:0015:0017:3019:454:451.250.163:45
1150.039.041.3043.454.45643.253.453.4561.25110.44
12Break0:45:0013:12
13£15.50STANDARD
14£23.25O/Time
15£1.40Bonus
16£0.17Fuel
17
050224 (2)
Cell Formulas
RangeFormula
E3:F9E3=MROUND(C3,(1/24/60)*15)
I3:I6,I8:I9I3=G3-O3-P3-Q3
J3:J9J3=I3+O3
I7I7=G7-O7-P7-Q7-N7
G10,P10:Q10,I10:L10I10=SUM(I3:I9)
I11:L11,G11,P11:Q11I11=CONCATENATE(24*DAY(I10)+HOUR(I10),".",MINUTE(I10))
P3:P9P3=G3-H3
Q3:Q9Q3=MOD(F3-E3,1)-H3
R3:R9R3=H3-I3
S3:S9S3=(K3*24)*A$15
T3:T9T3=(L3*24)*A$14
H3:H7H3=G3-B$12
O3:O7O3=O$10/60
B4:B9B4=B3+1
M3:M9M3=(J3*24)*A$13
L3:L9L3=MEDIAN("16:03","17:00",IF(F3<E3,1+F3,F3))-MEDIAN("16:03","17:00",E3)
G3:G9G3=MEDIAN("07:00","17:00",IF(F3<E3,1+F3,F3))-MEDIAN("07:00","17:00",E3)
M11,S11:T11M11=SUM(M3:M9)
K3:K6,K8:K9K3=I3+P3
K7K7=I7+P7+O7+O7
K12K12=G11-P11
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C3:F9Cell Value>0textNO



G11 -p11= k12 but k12 should be 46.25.
 
Upvote 0
Well, you are not subtracting TIME from TIME at this point.
Excel doesn't think the last part of the decimal can't exceed 59 hundredths.
it is subtracting .45 from 1.00 ( or .99 + .01).
 
Upvote 0
This is what I come up with:

In cell K14:
Excel Formula:
=DAY(G13-P13)*24+HOUR(G13-P13)&TEXT(MINUTE(G13-P13)/60,".00")

NOTE: this is now text, if you want to use it as a value, you'll need to multiply by 1 or add 0.

Book1
ABCDEFGHIJKLMNOPQRSTUV
1DayDateStart TimeFinish TimeRounded Time to nearest 15 MinRounded Time to nearest 15 MinHours workedTotal_45 BreakBasic HoursBasic + ServicingBasic Hours + BreaksOvertime Paid at Std RateServicingbreakHours @ OvertimeBonusover timeFuel Mileage
2Days Hours
3Monday4532707:00:0017:00:0007:00:0017:00:0010:00:0009:15:0008:00:0008:30:0008:45:0000:57:00131.7500:30:0000:45:0000:45:0001:15:0012.2522.087520
4Tuesday4532807:00:0017:00:0007:00:0017:00:0010:00:0009:15:0008:00:0008:30:0008:45:0000:57:00131.7500:30:0000:45:0000:45:0001:15:0012.2522.087520
5Wednesday4532907:00:0017:00:0007:00:0017:00:0010:00:0009:15:0008:00:0008:30:0008:45:0000:57:00131.7500:30:0000:45:0000:45:0001:15:0012.2522.087520
6Thursday4533007:00:0017:00:0007:00:0017:00:0010:00:0009:15:0008:00:0008:30:0008:45:0000:57:00131.7500:30:0000:45:0000:45:0001:15:0012.2522.087520
7Friday4533107:00:0017:00:0007:00:0017:00:0010:00:0009:15:0007:00:0007:30:0008:45:0000:57:00116.2501:00:0000:30:0000:45:0000:45:0002:15:0012.2522.087520
8Saturday453320000000000000
9Sunday453330000000000000
102.08333333333333001.6251.729166671.8229166670.1979166671.250.156250000.15625
11G11 -p11= k12 but k12 should be 46.25.50.039.041.3043.454.45643.253.453.4561.25110.44
12Break0.0312546.55
1315.5STANDARDFormat G10 as [HH:MM]50:0003:45
1423.25O/Time46.25
151.4Bonus
Sheet2
Cell Formulas
RangeFormula
E3:F9E3=MROUND(C3,(1/24/60)*15)
I3:I6,I8:I9I3=G3-O3-P3-Q3
J3:J9J3=I3+O3
I7I7=G7-O7-P7-Q7-N7
G10,P10:Q10,I10:L10I10=SUM(I3:I9)
I11:L11,G11,P11:Q11I11=CONCATENATE(24*DAY(I10)+HOUR(I10),".",MINUTE(I10))
P3:P9P3=G3-H3
Q3:Q9Q3=MOD(F3-E3,1)-H3
R3:R9R3=H3-I3
S3:S9S3=(K3*24)*A$15
T3:T9T3=(L3*24)*A$14
H3:H7H3=G3-B$12
O3:O7O3=O$10/60
B4:B9B4=B3+1
M3:M9M3=(J3*24)*A$13
L3:L9L3=MEDIAN("16:03","17:00",IF(F3<E3,1+F3,F3))-MEDIAN("16:03","17:00",E3)
G3:G9G3=MEDIAN("07:00","17:00",IF(F3<E3,1+F3,F3))-MEDIAN("07:00","17:00",E3)
M11,S11:T11M11=SUM(M3:M9)
K3:K6,K8:K9K3=I3+P3
K7K7=I7+P7+O7+O7
K12K12=G11-P11
G13G13=SUM(G3:G9)
P13P13=MROUND(SUM(P3:P9),15/(24*60))
K14K14=DAY(G13-P13)*24+HOUR(G13-P13)&TEXT(MINUTE(G13-P13)/60,".00")
 
Last edited:
Upvote 0
Payslip.xlsx
ABCDEFGHIJKLMNOPQRSTUVW
1DayDateStart TimeFinish TimeHours WorkedBreakHours Minus BreakServicingBasic HoursBasic Plus ServicingBonus HoursOvertimeAdjust for 39 hours spreadBasic PayOverTime PayBonus PayBreakdownsBonus Pay lostTotal Bonus PayMiles TravelledDaily Total
2Days Hours
3Monday05/02/202407:0017:0010:00:0000:45:0009:15:0000:30:0007:48:0008:18:0008:45:0000:57:0000:45:0000:12:00128.6522.0912.250.0012.2520.003.47166.46
4Tuesday06/02/202407:0017:0010:00:0000:45:0009:15:0000:30:0007:48:0008:18:0008:45:0000:57:0000:45:0000:12:00128.6522.0912.250.0012.2520.003.47166.46
5Wednesday07/02/202407:0017:0010:00:0000:45:0009:15:0000:30:0007:48:0008:18:0008:45:0000:57:0000:45:0000:12:00128.6522.0912.250.0012.2520.003.47166.46
6Thursday08/02/202407:0017:0010:00:0000:45:0009:15:0000:30:0007:48:0008:18:0008:45:0000:57:0000:45:0000:12:00128.6522.0912.250.0012.2520.003.47166.46
7Friday09/02/202407:0017:0010:00:0000:45:0009:15:0000:30:0007:48:0008:18:0008:45:0000:57:0000:45:0000:12:00128.6522.0912.250.0012.2520.003.47166.46
8Saturday10/02/2024
9Sunday11/02/2024
10
1102:0003:4522:1502:3015:0017:3019:4504:4503:4501:00
1250.03.4546.152.3039.041.3043.454.453.451.0643.25110.4461.250.000.0061.25100.0017.35832.29
13Break0:45:00
14£15.50STANDARD
15£23.25O/Time
16£1.40Bonus
17£0.17Fuel
18
191
202
213
224
235
246
257
268
279
2810
29
30
31
32
050224 (2)
Cell Formulas
RangeFormula
I3:I7I3=E3-F3-H3-M3-N3
J3:J7J3=I3+H3
K3:K7K3=E3-F3-H3
L3:L7L3=G3-J3
M3:M7M3=E3-G3
O3:O7O3=(J3*24)*A$14
P3:P7P3=(L3*24)*A$15
Q3:Q7Q3=(K3*24)*A$16
S3:S7S3=R3*A$16
T3:T7T3=Q3-S3
V3:V7V3=U3*A$17
W3:W7W3=O3+P3+T3+V3
E3:E7E3=D3-C3
G3:G7G3=E3-(F3)
B4:B9B4=B3+1
E11:N11E11=SUM(E3:E9)
E12:N12E12=CONCATENATE(24*DAY(E11)+HOUR(E11),".",MINUTE(E11))
O12:V12O12=SUM(O3:O7)
W12W12=SUM(W3:W9)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C3:D10Cell Value>0textNO
Cells with Data Validation
CellAllowCriteria
R3:R10List=$A$19:$A$28


Went back to the drawing board to simplify things so now it works.. But always a but.....
Needs tidying up if cell c3:d9 have no input in them, then i get various errors in other cells I know you can use iferror to cover this but cant seem to work out how can anyone assist
 
Upvote 0
@HappyChappy
When I copied your data over and typed data in C8:D9 I did not see and calculation errors.
What cells have formulas that are failing? (I don't see these in your xl2bb mini sheet either).
 
Upvote 0
if you remove say monday start and finish times then you will see the errors on that row appear
 
Upvote 0
if you remove say monday start and finish times then you will see the errors on that row appear
OK. Column G,I,J,K involve date/time subtractions and excel doesn't like going negative in date/time calculations (just my way of saying it, i'm sure there is a more accurate way). But, it isn't a typical formula error like #VALUE, #NA, #DIV/0. You just need to trap the situation that causes the calculation to happen.
So something like this:
Excel Formula:
=IF(OR(C3=0,D3=0),0,YourFormula)
 
Upvote 0
Solution
OK. Column G,I,J,K involve date/time subtractions and excel doesn't like going negative in date/time calculations (just my way of saying it, i'm sure there is a more accurate way). But, it isn't a typical formula error like #VALUE, #NA, #DIV/0. You just need to trap the situation that causes the calculation to happen.
So something like this:
Excel Formula:
=IF(OR(C3=0,D3=0),0,YourFormula)
thank-you for the assist
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,681
Members
449,116
Latest member
HypnoFant

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