Remove Text and Numbers from a cell

jake424

New Member
Joined
Dec 5, 2013
Messages
13
Hello,

I received a file that has text, numbers, and some more text in a string and I would like to break it out into 3 columns. Each cell contains a name, phone number, and email address, all in the same cell.

Example:
Tony Smith 123-456-7890 tony@smith.com
William Williamson 234-567-8901 x123 william@fakeemail.com
PJ Hin 345-678-9012 PJ@example.com

Unfortunately, the locations of the names, numbers, and emails aren't in the same spot. Is it possible to look this information up by spaces? For name can it look up the info before the second space, then after the 2nd space for number, and after the last space for email?

Thank you so much!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi Jake,

In your example what are you planning to do with Williamson. He would either require 4 columns or the ability to keep phone number and extension in one cell...

igold
 
Upvote 0
Last edited:
Upvote 0
If you're looking for something easy peasy... try doing a text to columns, then come back and concatenate the first and last names.

Cheers,

tonyyy
 
Upvote 0
If you want to try Vba

Code:
Sub seperateInfo()
    
    Dim s As String
    Dim stringA() As String
    Dim lastRow As Long
    
    lastRow = Range("A1").End(xlDown).Row
    
    For i = 2 To lastRow
        s = Cells(i, 1).Value
        stringA = Split(s)
        
        ActiveSheet.Cells(i, 2).Value = stringA(0) + " " + stringA(1)
        ActiveSheet.Cells(i, 3).Value = stringA(2)
        ActiveSheet.Cells(i, 4).Value = stringA(3)
        
    Next i
    
End Sub

Assuming your first row has header. Will do all rows until there is an empty row
 
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,103
Members
452,302
Latest member
TaMere

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