Attack from the Left

amerifax

Board Regular
Joined
Dec 17, 2008
Messages
247
Phone: 262-255-7430
=LEFT(D2,8)

Result of Cell D2
Phone: 9

I need to capture only the phone number. I want to disregard coming from the right side, because that approach is not 100%. Out of a quarter of 1 million records. I can always count on it looking like "Phone: 262-255-7430"

Therefore I would like to delete the first eight characters and retain the phone number.

Bob
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Phone: 262-255-7430
=LEFT(D2,8)

Result of Cell D2
Phone: 9

I need to capture only the phone number. I want to disregard coming from the right side, because that approach is not 100%. Out of a quarter of 1 million records. I can always count on it looking like "Phone: 262-255-7430"

Therefore I would like to delete the first eight characters and retain the phone number.

Bob
Just find the space, add 1, then take everything to the right of it.

=MID(D2,FIND(" ",D2)+1,25)
 
Upvote 0
Works good. at first I was a little confused about the 25 until I checked out the help file and found that every family that would give me every day after the first position of the space.

Yes, I can see this taking care of many situations that I have to deal with. Thank you very much.
Bob
 
Upvote 0
Works good. at first I was a little confused about the 25 until I checked out the help file and found that every family that would give me every day after the first position of the space.

Yes, I can see this taking care of many situations that I have to deal with. Thank you very much.
Bob
You're welcome. Thanks for the feedback! :cool:
 
Upvote 0
Phone: 262-255-7430
=LEFT(D2,8)

Result of Cell D2
Phone: 9

I need to capture only the phone number. I want to disregard coming from the right side, because that approach is not 100%. Out of a quarter of 1 million records. I can always count on it looking like "Phone: 262-255-7430"

Therefore I would like to delete the first eight characters and retain the phone number.

Bob

=SUBSTITUTE(D2,"Phone: ","")
 
Upvote 0
I would think you would want to get rid of the first 7 characters, not 8. At 8 you are already in the phone number:

=REPLACE(A1,1,7,"")
 
Upvote 0
Try this.
Public Function trimleft(mychar As String)
Dim newstring As String
newstring = Right(mychar, Len(mychar) - 7)
trimleft = newstring
End Function
 
Upvote 0
I interpreted the post to mean there might be ANY text before the phone number.

If the string is ALWAYS of the format: Phone: nnn-nnn-nnnn

Then why can't you simply use:

=RIGHT(D2,12)

Maybe even:

=MID(D2,8,25)
 
Upvote 0
If the cell contents of the 250,000 cells is always of the form:
Phone: ###-###-####

AND...you want to strip the leading text from those cells,
this approach uses no formulas and leaves only the phone numbers in the cells:
• Select the single-column range of cells to be impacted
• Data.Text-to-Columns...Check: Delimited...Click: Next
...Check: Space...Click: Next
...Select the 1st column...Check: Do not import this column
...Click: Finish

That would convert
A1: Phone: 123-456-7890
to
A1: 123-456-7890

Is that something you can work with?
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,476
Members
452,915
Latest member
hannnahheileen

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