Hours Minutes to Minutes...VBA/Excel

jamada

Active Member
Joined
Mar 23, 2006
Messages
323
Trying to convert hours to only minutes, however not certain what I'm doing wrong here, looking at the table O does not equal the minutes in N!
Tks Graham

Part of my code is as follows;

Columns("O:O").Select
Selection.NumberFormat = "0"

Dim Lastrow As Long
Lastrow = Range("A" & Rows.Count).End(xlUp).Row
Range("Q2:Q" & Lastrow).Formula = "=(11&""/""&LEFT(RC[-10],2)&""/""&14&"" ""&MID(RC[-10],3,2)&"":""&RIGHT(RC[-10],2))"
Range("P2:P" & Lastrow).Formula = "=(11&""/""&LEFT(RC[-3],2)&""/""&14&"" ""&MID(RC[-3],3,2)&"":""&RIGHT(RC[-3],2))"
Range("N2:N" & Lastrow).Formula = "=RC[3]-RC[2]"
Range("O2:O" & Lastrow).Formula = "=LEFT(N2,2)*60 +RIGHT(N2,2)"


Columns("N:N").Select
Selection.NumberFormat = "hh:mm"





Excel 2010
NO
1HH:MMMinutes
200:1088
301:0854
400:3571
Sheet2
Cell Formulas
RangeFormula
N2=Q2-P2
N3=Q3-P3
N4=Q4-P4
O2=LEFT(N2,2)*60 +RIGHT(N2,2)
O3=LEFT(N3,2)*60 +RIGHT(N3,2)
O4=LEFT(N4,2)*60 +RIGHT(N4,2)
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
If N2 is a real time it should just be
=N2*24*60

Edit: Format the cells as number rather than time.
 
Last edited:
Upvote 0
MARK858........ Worked very well in deed....... Thank You Very Much..... Happy New Year!
Graham

Range("O2:O" & Lastrow).Formula = "=(N2*24*60)"
 
Upvote 0
If you have a properly formatted time, that is, it is a fractional number formatted as hh:mm to display hours and minutes, you can format it as [mm] to show minutes only. 0:10 becomes 10, 1:10 becomes 70, 2:10 becomes 130, etc.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,861
Members
449,052
Latest member
Fuddy_Duddy

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