Replace count totals

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
890
Hi all, i would like to write a vba code in order to replace the count total in col. "P" so that where employees working hours are more than 4:51 should count 1 and where is less to 4:50 should count 0.50 (half). In my below extract the "2065 Count Total" should be 19.50.
Thanking you in advance



<tbody>
[TD="align: center"][/TD]
[TD="class: xl81, width: 87, align: center"]A[/TD]
[TD="class: xl81, width: 113, align: center"]B[/TD]
[TD="class: xl81, width: 95, align: center"]C[/TD]
[TD="class: xl81, width: 84, align: center"]D[/TD]
[TD="class: xl81, width: 63, align: center"]E[/TD]
[TD="class: xl81, width: 1, align: center"]O[/TD]
[TD="class: xl81, width: 72, align: center"]P[/TD]

[TD="align: center"]1[/TD]
[TD="class: xl69, align: center"]I.D.[/TD]
[TD="class: xl69, align: center"]Name[/TD]
[TD="class: xl69, align: center"]Date[/TD]
[TD="class: xl69, align: center"]IN[/TD]
[TD="class: xl69, align: center"]OUT[/TD]
[TD="class: xl69, align: center"][/TD]
[TD="class: xl75, align: center"]Total Time[/TD]

[TD="align: center"]2[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]1/11/2017[/TD]
[TD="class: xl67, align: center"]7:45:20[/TD]
[TD="class: xl67, align: center"]17:43:31[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:58[/TD]

[TD="align: center"]3[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]2/11/2017[/TD]
[TD="class: xl67, align: center"]7:46:06[/TD]
[TD="class: xl67, align: center"]18:01:07[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]10:15[/TD]

[TD="align: center"]4[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]3/11/2017[/TD]
[TD="class: xl67, align: center"]7:57:06[/TD]
[TD="class: xl67, align: center"]18:11:06[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]10:14[/TD]

[TD="align: center"]5[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]4/11/2017[/TD]
[TD="class: xl67, align: center"]7:46:34[/TD]
[TD="class: xl67, align: center"]16:25:49[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]8:39[/TD]

[TD="align: center"]6[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]6/11/2017[/TD]
[TD="class: xl67, align: center"]7:39:45[/TD]
[TD="class: xl67, align: center"]11:30:20[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl77, align: center"]3:91[/TD]

[TD="align: center"]7[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]7/11/2017[/TD]
[TD="class: xl67, align: center"]7:45:18[/TD]
[TD="class: xl67, align: center"]17:43:49[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:58[/TD]

[TD="align: center"]8[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]8/11/2017[/TD]
[TD="class: xl67, align: center"]7:43:07[/TD]
[TD="class: xl67, align: center"]17:26:02[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:43[/TD]

[TD="align: center"]9[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]14/11/2017[/TD]
[TD="class: xl67, align: center"]7:43:54[/TD]
[TD="class: xl67, align: center"]17:54:35[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]10:11[/TD]

[TD="align: center"]10[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]15/11/2017[/TD]
[TD="class: xl67, align: center"]8:11:19[/TD]
[TD="class: xl67, align: center"]16:50:17[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]8:39[/TD]

[TD="align: center"]11[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]16/11/2017[/TD]
[TD="class: xl67, align: center"]7:55:30[/TD]
[TD="class: xl67, align: center"]17:29:32[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:34[/TD]

[TD="align: center"]12[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]17/11/2017[/TD]
[TD="class: xl67, align: center"]7:43:36[/TD]
[TD="class: xl67, align: center"]12:30:20[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl77, align: center"]4:87[/TD]

[TD="align: center"]13[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]20/11/2017[/TD]
[TD="class: xl67, align: center"]7:43:31[/TD]
[TD="class: xl67, align: center"]17:04:09[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:21[/TD]

[TD="align: center"]14[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]21/11/2017[/TD]
[TD="class: xl67, align: center"]7:40:08[/TD]
[TD="class: xl67, align: center"]16:41:41[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:01[/TD]

[TD="align: center"]15[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]22/11/2017[/TD]
[TD="class: xl67, align: center"]7:41:35[/TD]
[TD="class: xl67, align: center"]17:20:32[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:39[/TD]

[TD="align: center"]16[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]23/11/2017[/TD]
[TD="class: xl67, align: center"]7:39:23[/TD]
[TD="class: xl67, align: center"]17:02:59[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:23[/TD]

[TD="align: center"]17[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]24/11/2017[/TD]
[TD="class: xl67, align: center"]7:44:40[/TD]
[TD="class: xl67, align: center"]16:45:47[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:01[/TD]

[TD="align: center"]18[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]27/11/2017[/TD]
[TD="class: xl67, align: center"]7:43:02[/TD]
[TD="class: xl67, align: center"]16:52:56[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:09[/TD]

[TD="align: center"]19[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]28/11/2017[/TD]
[TD="class: xl67, align: center"]7:50:06[/TD]
[TD="class: xl67, align: center"]17:39:08[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:49[/TD]

[TD="align: center"]20[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]29/11/2017[/TD]
[TD="class: xl67, align: center"]7:42:02[/TD]
[TD="class: xl67, align: center"]17:16:47[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]9:34[/TD]

[TD="align: center"]21[/TD]
[TD="class: xl65, align: center"]2065[/TD]
[TD="class: xl65, align: center"]EMPL. 2065[/TD]
[TD="class: xl66, align: center"]30/11/2017[/TD]
[TD="class: xl67, align: center"]9:06:36[/TD]
[TD="class: xl67, align: center"]17:30:12[/TD]
[TD="class: xl68, align: center"][/TD]
[TD="class: xl76, align: center"]8:24[/TD]

[TD="align: center"]22[/TD]
[TD="class: xl74, align: center"]2065 Count[/TD]
[TD="class: xl71, align: center"][/TD]
[TD="class: xl72, align: center"][/TD]
[TD="class: xl73, align: center"][/TD]
[TD="class: xl71, align: center"][/TD]
[TD="class: xl71, align: center"][/TD]
[TD="class: xl78, align: center"]20[/TD]

[TD="align: center"]23[/TD]
[TD="class: xl70, align: center"]2065 Total[/TD]
[TD="class: xl71, align: center"][/TD]
[TD="class: xl72, align: center"][/TD]
[TD="class: xl73, align: center"][/TD]
[TD="class: xl71, align: center"][/TD]
[TD="class: xl71, align: center"][/TD]
[TD="class: xl79, align: center"][/TD]

[TD="align: center"]24[/TD]
[TD="class: xl70, align: center"][/TD]
[TD="class: xl71, align: center"][/TD]
[TD="class: xl72, align: center"][/TD]
[TD="class: xl73, align: center"][/TD]
[TD="class: xl71, align: center"][/TD]
[TD="class: xl71, align: center"][/TD]
[TD="class: xl79, align: center"][/TD]

[TD="align: center"]25[/TD]
[TD="class: xl65, align: center"]2088[/TD]
[TD="class: xl65, align: center"]EMPL. 2088[/TD]
[TD="class: xl66, align: center"]7/11/2017[/TD]
[TD="class: xl67, align: center"]8:59:22[/TD]
[TD="class: xl67, align: center"]17:47:46[/TD]
[TD="class: xl65, align: center"][/TD]
[TD="class: xl76, align: center"]8:48[/TD]

</tbody>
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Row 6 3:50 0.5
Row 12 4:46 0.5

2065 total sum 19

I'm using this formula

Code:
[COLOR=#0000cd]=IF(((E2-D2)*1440)>=291,1,0.5)[/COLOR]
 
Upvote 0
Hi Ihart,
Thank you for your support. The above formula works but can u explain me whats the mean of the numbers 1440 & 291? I know that the working monthly hours should be 173.33. However thanks once again for your help. Have a nice day
 
Upvote 0
Those numbers I use to convert time value to decimal value.
1440 is from minutes in 1 day (24 hours * 60 minutes )
291 is from 4:51 * 1440

Sorry about my english.
 
Upvote 0
Hi lhart, Thank you so much for explanation. Just i wanted to see the logic of the formula.
I understand you very well and so do not worry about English. I am so glad, that you help me and you resolve my problem. It was very kind of you.
All the best to you!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
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