converting expression into total mins

Ivn68

Board Regular
Joined
Aug 21, 2015
Messages
82
i have data that is imported into excell.
the data is expressed like this"1h, 24m"
which indicates 1 hour 24 minutes
how can i convert that into total mins
excell doesnt recognise "1h, 24m" as a measure of time
is there any vba formula i could use to convert it into total mins?

thanks for any help
 
IVN68 I have the same question however
i have data that is imported into excel.
the data is expressed like this "[TABLE="class: cms_table, width: 101"]
<tbody>[TR]
[TD="width: 101"]10 h 12 m "[/TD]
[/TR]
</tbody>[/TABLE]

which indicates 10 hour 12 <vb_highlight>minutes</vb_highlight>
how can i convert that into total mins
excell doesnt recognize "10 h 12 m as a measure of time
Please assist
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Rick I have the same question however
i have data that is imported into excel.
the data is expressed like this " [TABLE="width: 101"]
<tbody>[TR]
[TD="width: 101"]10 h 12 m "[/TD]
[/TR]
</tbody>[/TABLE]
which indicates 10 hour 12 <vb_highlight>minutes</vb_highlight>
how can i convert that into total mins
Give this formula a try...

=0+SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1," ",""),"h",":"),"m",":00")
 
Upvote 0
I tried that and for 15 h 10 m it gave [TABLE="width: 84"]
<tbody>[TR]
[TD="class: xl68, width: 84, align: right"]0.6319444[/TD]
[/TR]
</tbody>[/TABLE]
That is how Excel sees time values... select the cell with the formula(s) and then set the cell format to the time display that you want to see.
 
Upvote 0
thank you I changed my format to 15 h, 10 m and used a replace h with h, and used your formula
=0+SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1," ",""),"h",":"),"m",":00") and let that work. Thanks for your help.
 
Upvote 0
I can't get the vba macro to work
Column a is first name column b is last name column c is the time
The format is " 1 h , 15 m". And I want it converted into total minutes. So it would come back 75.
 
Upvote 0
I can't get the vba macro to work
Column a is first name column b is last name column c is the time
The format is " 1 h , 15 m". And I want it converted into total minutes. So it would come back 75.
You "time values" have extra spaces that the original poster's values did not have and they are getting in the way of the macro (and formulas) work. Here is a revised macro that should work for the data structure you posted...
Code:
[table="width: 500"]
[tr]
	[td]Sub ConvertToTimeValue()
  With Range("C1", Cells(Rows.Count, "C").End(xlUp))
    .Value = Evaluate("IF({1},0+SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(" & .Address & ","" "",""""),""h,"","":""),""m"","":00""))")
    .NumberFormat = "[h]:mm"
  End With
End Sub[/td]
[/tr]
[/table]
 
Upvote 0
The time is expressed like "1 h, 15 m". It converts it to " 1:15". I need it to convert it to total minutes so it should be "75"
 
Upvote 0
The time is expressed like "1 h, 15 m". It converts it to " 1:15". I need it to convert it to total minutes so it should be "75"
Sorry, I missed that part of your request. Give this macro a try instead...
Code:
[table="width: 500"]
[tr]
	[td]Sub ConvertToTotalMinutes()
  With Range("C1", Cells(Rows.Count, "C").End(xlUp))
    .Value = Evaluate("IF({1},1440*SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(" & .Address & ","" "",""""),""h,"","":""),""m"","":00""))")
    .NumberFormat = "General"
  End With
End Sub[/td]
[/tr]
[/table]
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
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