Split Text

slinky192001

Board Regular
Joined
Mar 16, 2007
Messages
100
Hello

I have a list of cells in column A as follows:

9h 2m
104h 32m
etc

There is always a space between the hours and minutes so i would like to split the hours and minutes into seperate columns.
I know i have done this before but cant think for the life of me how.

Any help is greatly appreciated.

Thanks
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Code:
Sub Separate()

    Dim i As Long, arr As Variant
    
    For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
        arr = Split(Cells(i, 1))
        Cells(i, 2) = arr(0)
        Cells(i, 3) = arr(1)
    Next
    
End Sub
 
Upvote 0
Text to Columns is probably best if it's a one-off task, but here are the worksheet formulae if you need them:-
Code:
=TRIM(LEFT(A1,FIND(" ",A1&" ")-1))
=TRIM(MID(A1,FIND(" ",A1&" ")+1,255))
(assuming that your data is in A1)
 
Upvote 0

Forum statistics

Threads
1,224,520
Messages
6,179,266
Members
452,902
Latest member
Knuddeluff

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