Hard Time With Time Calculation/Converting To Number

ackalbo

New Member
Joined
Mar 10, 2013
Messages
46
Good evening everyone, I have been trying to get this working for the most part of the day and I'm sure I'm missing something.

I am working on a Lateness Penalty Spreadsheet were people are fined X amount per minute late so I am trying to calculate how many minutes an employee is late to work and then multiply this value by an number to determine the monetary value.

First things first - Here is the raw data which is exported from our Biometric Database:

Excel 2010
ABCDEF
6Raw Data (Imported From Biometric Access Database)
7
8Emp NoNameDateTime InTime OutDuration
93013Susan22-Dec-134:13:01 PM12:21:02 AM8.13
103013Susan24-Dec-134:18:33 PM2:01:13 AM9.71
113013Susan25-Dec-134:27:22 PM2:04:27 AM9.61
123013Susan26-Dec-135:05:19 PM2:59:58 AM9.91
133015Michael22-Dec-135:14:49 PM2:02:50 AM8.8
143015Michael23-Dec-135:10:12 PM1:58:08 AM8.79
153015Michael25-Dec-135:00:13 PM2:03:26 AM9.05
163026James22-Dec-134:20:06 PM2:01:30 AM9.69
173026James25-Dec-134:11:40 PM10:25:48 PM6.23
183026James26-Dec-134:11:33 PM2:55:55 AM10.73
193037Evangeline22-Dec-134:28:17 PM10:38:39 PM6.17
203037Evangeline22-Dec-1310:38:42 PM10:38:48 PM0
213037Evangeline23-Dec-135:52:05 PM2:02:10 AM8.16
223037Evangeline25-Dec-134:48:58 PM2:00:27 AM9.19
233037Evangeline26-Dec-135:30:16 PM2:57:01 AM9.44
243049Jackie22-Dec-134:39:38 PM2:02:22 AM9.37
253049Jackie23-Dec-134:31:45 PM2:01:28 AM9.49
263049Jackie25-Dec-134:39:34 PM2:00:46 AM9.35
273049Jackie26-Dec-135:42:01 PM2:59:30 AM9.29
283058Ian22-Dec-134:30:32 PM2:01:39 AM9.51
293058Ian26-Dec-134:52:23 PM2:58:52 AM10.1

<tbody>
</tbody>
Late Fine Test

I would like to mention here that Column C (Date) is formatted as "Custom: d-mmm-yy" with a xxxxx.00 value and Column D (Time In) is formatted as "Custom: h-mm-ss AM/PM" with a xxxxx.xxxxx value.


I have so far managed to manipulate the above raw data into the following table using the following formula within the Employee Name/Date intercept cells:

Code:
{=INDEX(TimeIn,MATCH(I9,IF(DateWorked=$L$8,EmpNo),0))}

Excel 2010
IJKLMNOPQRSTU
22Emp NoNameStart Time22-Dec-13Late (Mins)23-Dec-13Late (Mins)24-Dec-13Late (Mins)25-Dec-13Late (Mins)26-Dec-13Late (Mins)
233013Susan17:004:13 PM#N/A4:18 PM4:27 PM5:05 PM
243015Michael17:005:14 PM5:10 PM#N/A5:00 PM#N/A
253026James17:004:20 PM#N/A#N/A4:11 PM4:11 PM
263037Evangeline17:004:28 PM5:52 PM#N/A4:48 PM5:30 PM
273049Jackie17:004:39 PM4:31 PM#N/A4:39 PM5:42 PM
283058Ian17:004:30:32 PM#N/A#N/A#N/A4:52:23 PM

<tbody>
</tbody>
Late Fine Test

The times in Columns L, N, P, R & T are formatted as "Custom: h:mm AM/PM" with a value of xxxxx.xxxxx - The Start Time (Column K) on the other hand is formatted as "Time: 13:30" with a value of .xxxxx (In my mind I am sure this where the problem at least starts)

Using Row 24 as an example, Michael is 14 minutes late so I am trying to get "14" into cell M24 (if the employee is early then "0"). I tried
Code:
=(L24-INT(L24))-K24
but this gave a result of "12:14 AM" with an numerical value of 0.01029.

I understand the concept that Excel looks at date/time as a serial number with the date to the left of the decimal point and the time to the right, I just can't seem to achieve the results that I would like i.e. have the number "14" displayed in cell M24 and be able to multiply this by an integer (2) to come to the end result of "28" (if the employee was 55 mins late then the result would need to be 110 and not 1hr 40mins).

Any help would be greatly appreciated guys and gals as I've reached the "pulling my hair out" stage hehehe.
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi, make sure that cell format for M24 is "General" and try M24=(((HOUR(L24)-HOUR(K24))*60)+(MINUTE(L24)-MINUTE(K24)))*2
 
Upvote 0
Alvin-chung, thank you very much - your solution works perfectly. I shall spend some time tomorrow looking at your solution and how it works :)
 
Upvote 0
Using Row 24 as an example, Michael is 14 minutes late so I am trying to get "14" into cell M24 (if the employee is early then "0"). I tried

Code:
=(L24-INT(L24))-K24

but this gave a result of "12:14 AM" with an numerical value of 0.01029.
Do you get the correct answer using this modified version of your formula?

Code:
=1440*(L24-INT(L24)-K24)

where you will probably need to manually set the cell's format to General after you enter the formula.
 
Upvote 0

Forum statistics

Threads
1,215,165
Messages
6,123,390
Members
449,098
Latest member
ArturS75

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