Extracting phone number for each cell

ABBOTTS04

New Member
Joined
Jul 22, 2019
Messages
2
WHAT FORMULA WOULD WORK TO EXTACT JUST THE PHONE NUMBER FROM EACH CELL. IT STARTS WITH CELL A2

WCW ORGANIZATION INC. : Email- rooz51@gmail.com : Phone- 3108455117

<colgroup><col></colgroup><tbody>
</tbody>

THANK YOU
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
WHAT FORMULA WOULD WORK TO EXTACT JUST THE PHONE NUMBER FROM EACH CELL. IT STARTS WITH CELL A2

WCW ORGANIZATION INC. : Email- rooz51@gmail.com : Phone- 3108455117

<colgroup><col></colgroup><tbody>
</tbody>
One example is not usually all that all that helpful in describing one's data. For example, is the phone number always at the end of the text? Is the phone number always shown without dashes or parentheses? Does the word "Phone" alway precede the phone number? Along with many other questions as well...
 
Last edited:
Upvote 0
Good points Rick. More examples would be helpful. But, if your example is a good representation of what all of your data looks like, then this should do it.

Code:
Function PHONE(s As String) As String
Dim RX As Object: Set RX = CreateObject("VBScript.RegExp")
Dim pat As String: pat = "\d{10}"


With RX
    .Pattern = pat
    .Global = True
    .MultiLine = True
    .ignorecase = True
    PHONE = .Execute(s)(0)
End With


End Function
 
Upvote 0
Good points Rick. More examples would be helpful. But, if your example is a good representation of what all of your data looks like, then this should do it.

Code:
Function PHONE(s As String) As String
Dim RX As Object: Set RX = CreateObject("VBScript.RegExp")
Dim pat As String: pat = "\d{10}"


With RX
    .Pattern = pat
    .Global = True
    .MultiLine = True
    .ignorecase = True
    PHONE = .Execute(s)(0)
End With


End Function
If you assume the example is a good representation, then I would suggest this function instead :devilish:
Code:
Function PHONE(S As String) As String
  PHONE = Right(S, 10)
End Function
Hence, my questions.
 
Upvote 0
One example is not usually all that all that helpful in describing one's data. For example, is the phone number always at the end of the text? Is the phone number always shown without dashes or parentheses? Does the word "Phone" alway precede the phone number? Along with many other questions as well...

WCW ORGANIZATION INC. : Email- rooz51@gmail.com : Phone- 3108455117
420 FOR THE PEOPLE COOPERATIVE INC : Stash Studio City : Email- 420forthepeople@gmail.com : Phone- 8188105353
POINT BAY DISTRIBUTORS, LLC : Point Bay Distributors, LLC : Email- info@pointbaydist.com : Phone- 8505103483 : Website- https://www.pointbaydist.com/
KALI BOTANICALS : Kali Botanicals : Email- kalibotanicals213@gmail.com : Phone- 9512646666

<colgroup><col></colgroup><tbody>
</tbody>
 
Upvote 0
WCW ORGANIZATION INC. : Email- rooz51@gmail.com : Phone- 3108455117
420 FOR THE PEOPLE COOPERATIVE INC : Stash Studio City : Email- 420forthepeople@gmail.com : Phone- 8188105353
POINT BAY DISTRIBUTORS, LLC : Point Bay Distributors, LLC : Email- info@pointbaydist.com : Phone- 8505103483 : Website- https://www.pointbaydist.com/
KALI BOTANICALS : Kali Botanicals : Email- kalibotanicals213@gmail.com : Phone- 9512646666

<colgroup><col></colgroup><tbody>
</tbody>
It appears that your phone numbers are always 10 digits long with no dashes or parentheses and always follow the text "Phone- ". You could use the function that lrobbo314 posted, but another function that would also work is this...
Code:
Function PHONE(s As String) As String
  PHONE = Left(Split(s, "Phone- ")(1), 10)
End Function
 
Upvote 0
@Rick
I've never seen / noticed that before ???
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

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