Convert number and text cell time to decimal cell time for Google Sheets

toplad

New Member
Joined
Apr 12, 2015
Messages
19
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I've got an issue with some time data that is exported from a program like this into cells (each number with text in each cell descending all in column a)

0h

14h

17h

17h

25h 30m

0h

8h 30m

7h

I need to somehow have this converted in to decimal time 25.5 the main problem is that it has text it the cells (h and m) which I cant remove to even start converting it. Any ideas the best way to solve this?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
How about
+Fluff 1.xlsm
AB
1
20h0
314h14
417h 15m17.25
517h17
625h 30m25.5
70h0
88h 30m8.5
97h7
Main
Cell Formulas
RangeFormula
B2:B9B2=IF(ISNUMBER(FIND("m",A2)),SUBSTITUTE(SUBSTITUTE(A2,"h ",":"),"m",":0"),SUBSTITUTE(A2, "h",":0"))*24
 
Upvote 0
This is amazing, youd def laugh if i showed you what i was trying...it involved about 8 columns trying to split it out! works in excel but now i've moved it into google sheets it throws me this 'Function MULTIPLY parameter 1 expects number values. But '0:0' is a text and cannot be coerced to a number.' Any way round this?
 
Upvote 0
In future if you need something for a spreadsheet other than Excel, you should make that clear in the title, or post & it should be posted in the General Discussion & Other Applications section os the site.
I have done that for you this time.
 
Upvote 0
Sorry i should have said that its used in excel and in sheets (thought they worked the same)
 
Upvote 0
I've no idea how sheets handles time, but try
Excel Formula:
=IF(ISNUMBER(FIND("m",A2)),SUBSTITUTE(SUBSTITUTE(A2,"h ",":"),"m",":0"),SUBSTITUTE(A2, "h",":0:0"))*24
 
Upvote 0
Solution
Thank you for doing that!

The only odd one which comes up in both formulas is that 4h 45m formats to 4.75
 
Upvote 0
That's what it should be. 45m is 3/4 of an hour.
 
Upvote 0
Sorry you're right, its been a long day staring at this sheet trying to solve what you've done.

Thank you and if you're every near Scarborough I owe you a pint or any other drink of your choice!
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,366
Messages
6,171,662
Members
452,416
Latest member
johnog

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