split concatenated string (with separator) to column (numeric)

Cedric51

New Member
Joined
Oct 20, 2016
Messages
3
hi all,

I am a very beginner in VB/Excel. In the column AI of the tab 'Main' in Excel, there is the string '163.31,185.00,206.52,228.33,249.94,271.53,293.14,314.90,336.46'. I want to split (delimiter = ',') the different values and create a column of numeric, for this example, I have to get the following column in AI
163.31
185.00
206.52
228.33
249.94
271.53
293.14
314.90
336.46

Of course, these values has to be numeric. any simple solutions?

Thank you.

Cedric
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Welcome to the forum!

Not sure how familiar you are with arrays, but a pretty easy task. Using the Split function, you can assign the values to an array, then send that array back to the worksheet.

Code:
Sub SplitString()
Dim rng As Range
Dim arr As Variant


Set rng = [AI1]
arr = Split(rng.Value, ",")
Set rng = rng.Resize(UBound(arr) + 1, 1)
rng = Application.Transpose(arr)
rng.NumberFormat = "0.00"
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,882
Members
449,097
Latest member
dbomb1414

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