Multiply and convert minutes to hours

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
882
Hi all, kindly require to provide me support so that to create a VBA code which should convert the minutes decimals in col. "L" to hours multiplying by 0.60. On my first below extract i appear the original data and on second i appear the expected result.

e.g. 01-Aug-2018 9.67 should be 9.40 (67*0.60=40.20). we get the first decimals (40) and should turn the number 9.67 to 9.40.

Thanks in advance

Original data

ABCDEFGL
1CODENameDateTIME ON DUTYTIME OFF DUTYINOUTW. HRS
21EMPLOYEE 101-Aug-1808:0017:007:3017:109.67
31EMPLOYEE 102-Aug-1808:0017:007:4516:308.75
41EMPLOYEE 103-Aug-1808:0017:008:1417:209.10
51EMPLOYEE 104-Aug-1808:0017:007:4516:148.48

<tbody>
</tbody>


Expected result

ABCDEFGL
1CODENameDateTIME ON DUTYTIME OFF DUTYINOUTW. HRS
21EMPLOYEE 101-Aug-1808:0017:007:3017:109.40
31EMPLOYEE 1 02-Aug-1808:0017:007:4516:308.45
41EMPLOYEE 103-Aug-1808:0017:008:1417:209.06
51EMPLOYEE 104-Aug-1808:0017:007:4516:148.29

<tbody>
</tbody>
 
Last edited:

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Can i ask why? Is it just for a visual? If so why not divide the number by 24 and format to time. If you are doing any calculations with that converted number they will be wrong (sum for example).
 
Upvote 0
Hi steve, i already done it. Is a formula by which like, =SUM(G2-F2)*24, and it appears the result 9.67. So i have to convert the minutes to hours proportion but using VBA. Thanks for your support
 
Last edited:
Upvote 0
Im still not understanding why? If you just use =G2-F2 you can then format to time and see what you want.
 
Upvote 0
Hi, lets check 2/8/18 =G2-F2=8.85. My query is that, there is NO such hour. So we should convert 0.85 against 1 hour. (method of three equation) The formula should be 85 * 0.60 = 0.51 against hour. The actual working hours for that date is 8.51 and not 8.85. Note that 0.10 difference is due to rounding and do not taking into consideration.
 
Upvote 0
Ok so we are talking about =G3-F2 ? What im saying is do not then multiply that by 24. Instead just format that cell to time. Right click, format cells, time. You will then see what you ask for. If you really want to get L3 from 8.75 to 8.45 you can do this:

=INT(L3)+MOD(L3,1)*0.6
 
Upvote 0
Hi, Ok thank you. I used your first suggestion by format, cells, time and it works perfect but now i cannot prepare the "SUM" for each employee end of month. i couldn't understand your formula. Thanks once again for your support.
 
Upvote 0
It would be easier if all the time entries were in excel serial time rather than decimal hours.

The formula in L2 would be =G2-F2. The cell could be formatted to one of the date formats.

When downstream calculations need hours, that is the point to convert from Excel Serial Time to decimal hours.
 
Upvote 0
hi mike, i agree with above but i need such formula so that to appear the correct hour in decimals but NOT as a time format, so that to be able to prepare the total of them. Is there anyu option so that to "SUM" with time format?

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,472
Messages
6,125,003
Members
449,203
Latest member
Daymo66

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