ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do i extract multiple data from a cell(string) whose length v. (https://www.excelbanter.com/excel-programming/397775-how-do-i-extract-multiple-data-cell-string-whose-length-v.html)

Gits

how do i extract multiple data from a cell(string) whose length v.
 
I need to extract all numbers into different columns (delimiter is ,). e.g.
1,325,16420,5,6,120,4643,2,8,-71,-68,-6 the length of numbers within
could vary.

joel

how do i extract multiple data from a cell(string) whose length v.
 
Put you comma delimited string in cell A1. code will put numbers starting in
row 2 cell A2.

Sub splitstring()

MyString = Range("A1").Value
MyOff = 0
Do While InStr(MyString, ",") 0
MyNum = Val(Left(MyString, InStr(MyString, ",") - 1))
MyString = Mid(MyString, InStr(MyString, ",") + 1)
Range("A2").Offset(0, MyOff).Value = MyNum
MyOff = MyOff + 1
Loop
MyNum = Val(MyString)
Range("A2").Offset(0, MyOff).Value = MyNum

End Sub


"Gits" wrote:

I need to extract all numbers into different columns (delimiter is ,). e.g.
1,325,16420,5,6,120,4643,2,8,-71,-68,-6 the length of numbers within
could vary.


Stefi

how do i extract multiple data from a cell(string) whose length v.
 
Data/Text to Columns/separated by comma

Regards,
Stefi

€˛Gits€¯ ezt Ć*rta:

I need to extract all numbers into different columns (delimiter is ,). e.g.
1,325,16420,5,6,120,4643,2,8,-71,-68,-6 the length of numbers within
could vary.



All times are GMT +1. The time now is 07:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com