number from text

narendra1302

Active Member
Joined
Sep 23, 2009
Messages
273
Dear all,

I have one column in Excel Sheet.
e.g.
LX45
rt56
roi89
wers56
KL43
k5

now how to seperate text & number - e.g. if rt56 then "rt" should be in one cell & "56" in another

Thanks
Narendra
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi Narendra

are your source values always letters then numbers or can you have:

ab123cd
123abc
a1b2c3
1abc2def

Martin
 
Upvote 0
so are you expecting the letters to be concatenated in one cell and the numbers concatenated in another
 
Upvote 0
Give this a try.

Select the range you want to extract the Numbers and letters from.

Code:
Sub Seperate()
Dim NumStr As String, LetStr As String
Dim i As Long
Dim rng As Range

Set rng = Selection

For Each cell In rng.Cells
    For i = 1 To Len(cell.Value)
        If IsNumeric(Mid(cell.Value, i, 1)) Then
            NumStr = NumStr & Mid(cell.Value, i, 1)
        Else
            LetStr = LetStr & Mid(cell.Value, i, 1)
        End If
    Next i
Cells(cell.Row, cell.Column + 1).Value = NumStr
Cells(cell.Row, cell.Column + 2).Value = LetStr
NumStr = ""
LetStr = ""
Next
End Sub
 
Upvote 0
Comfy I concur

I was goin down ther UDF route buut if you highlight all the codes and then run the macro its work fine even with my examples.
 
Upvote 0
Dear Comfy & MartinL,

Can we have this for Date also.

That is if the number is replaced by Date, then how to get this in two different columns.

Thanks
Narendra
 
Upvote 0

Forum statistics

Threads
1,224,568
Messages
6,179,595
Members
452,927
Latest member
whitfieldcraig

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