How do I seperate the first string of numbers from text in a cell?

must0401

New Member
Joined
Jul 27, 2017
Messages
1
I am trying to separate out the first four or five numbers in a cell that are followed by two or three letters and then followed by two or three more numbers. The problem I am running into is there are no spaces separating any characters. The cells will look like the following.

13244vww98
or
1234bbp90

I would like them to look like "13244" in first cell "vww" in second cell and "98" in third cell.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Assuming either, or both, of the number parts could start with a leading zero, put the following formulas in the indicated cells and copy them down to the end of your data...

B1: =LEFT(A1,4+(ISNUMBER(-MID(A1,5,1))))

C1: =SUBSTITUTE(SUBSTITUTE(A1,B1,""),D1,"")

D1: =RIGHT(A1,2+ISNUMBER(-MID(A1,LEN(A1)-2,1)))
 
Upvote 0
Welcome in the forum, this is what you search from what I understood.

Try this in a COPY of your file.
I can say that nothing to separate complicate the problem.

Code:
Sub Separate()
Dim r As Range
Dim s As String
Dim i As Integer
Dim i2 As Integer
For Each r In Range("A1:A2")
    i = 1
    s = r
    Do Until Not IsNumeric(Mid(s, i, 1))
        i = i + 1
    Loop
    r = Mid(s, 1, i - 1)
    i2 = i
    Do Until IsNumeric(Mid(s, i, 1))
        i = i + 1
    Loop
    r.Offset(0, 1) = Mid(s, i2, i - i2)
    r.Offset(0, 2) = Mid(s, i, Len(s) - i + 1)
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,029
Members
452,542
Latest member
Bricklin

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