Extract multiple numbers from an horizontal string to vertical cells

JohnBi

New Member
Joined
Aug 1, 2016
Messages
31
Office Version
  1. 2019
Platform
  1. Windows
Hello to everybody
I have many of "25918, 26012, 26188,26506,26824,26964" strings where, btwn numbers there is a comma only or a comma plus a space.
Is there a formula to extract each group of numbers in a cell like the picture? At the moment I am doing "data to column" and then "copy-paste/transpose".
Thank you for your help and time.
Regards
John

 

Attachments

  • Img_excel.gif
    Img_excel.gif
    5.4 KB · Views: 30

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Hi
For one range A1
a VBA
VBA Code:
Sub test()
Dim x
x = Split(Cells(1, 1), ",")
Cells(2, 1).Resize(UBound(x)) = Application.Transpose(x)

End Sub
 
Upvote 0
Thanks for that.
How about
Fluff.xlsm
A
1
225918, 26012, 26188,26506,26824,26964
3
425918
526012
626188
726506
826824
926964
10 
11 
Master
Cell Formulas
RangeFormula
A4:A11A4=IFERROR(FILTERXML("<k><m>"&SUBSTITUTE($A$2,",","</m><m>")&"</m></k>","//m["&ROWS(A$4:A4)&"]"),"")


The formula may need to be confirmed with Ctrl Shift Enter.
 
Upvote 0
Solution
Hi,
can I ask you please to confirm the formula, as I can see some Html code:
=IFERROR(FILTERXML(SUBSTITUTE($A$2,",","),ROWS(A$4:A4)),"")

Thanks for your help.
Regards
John
 
Upvote 0
Hi
For one range A1
a VBA
VBA Code:
Sub test()
Dim x
x = Split(Cells(1, 1), ",")
Cells(2, 1).Resize(UBound(x)) = Application.Transpose(x)

End Sub
Thank you for your suggestion, it works fine.
John
 
Upvote 0
Thanks to you as well for your suggestion, it works fine and I was not aware about the "Filterxml" function. Very interesting.
John
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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