SEPARATING ALPHANUMERIC DATA WHEN PATTERN IS IRREGULAR

tyronemeister

New Member
Joined
Jun 30, 2006
Messages
28
Is there a way to automatically separate numbers and letters in cells when the number of letters and/or numbers varies, preferably with vba? That is, separate them to different columns.

There's no delimiter and the width is not fixed, so the text to columns feature is not useful without sorting the information first. Apparently, isnumber cannot be used to because numbers are recognized as text when concatenated with letters.

Here's an example of what I want to do:

Before separating the data:

12ABB
1ABB
12AB

After separating:

Code:
Col1    Col2

12       ABB
1        ABB
12       AB

Thanks.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Are the numbers always at the start?
Code:
Sub Seperate()
    For Each c In Range("A1:A10")
    
        c.Offset(, 1) = Val(c.Value)
        c.Offset(, 2) = Mid(c.Value, Len(c.Offset(, 1)) + 1)
        
    Next c
End Sub
 
Upvote 0
Yes, but you may wish to make note of the difference in output should the input ever stray from the format you describe. Compare the results of each when inputs are things like<ul>[*]1AB2DE3[*]123ABC123[*]GHI789[*]XYZ[*]123[/list]I cannot speculate as to which solution would yield more desireable results for you (or indeed perhaps neither would). But I would think that from your POV it would be worth noting.
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,011
Members
448,935
Latest member
ijat

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