extract email address and phone number

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Welcome to the MrExcel board!

Are your phone numbers always 10 digits with dashes like in that example?
Is the email address always followed by a date?

Hard to tell from one example only. What about 5-10 varied examples and the expected results with XL2BB?
 
Upvote 0
Welcome to the MrExcel board!

Are your phone numbers always 10 digits with dashes like in that example?
Is the email address always followed by a date?

Hard to tell from one example only. What about 5-10 varied examples and the expected results with XL2BB?
Yes always like that with the same exact format. Only thing that changes are the values.
 
Upvote 0
I don't know how you'll separate the name from the title, but this should handle the phone and email, I think:

temporary.xlsm
BC
1Phoneemail
2213-225-3576hill13503@sbcglobal.net
Sheet6
Cell Formulas
RangeFormula
B2B2=MID(A2,SEARCH("???-",A2),12)
C2C2=MID(A2,SEARCH("???-",A2)+12,SEARCH("??/",A2)-(SEARCH("???-",A2)+12))
 
Upvote 0
This might do it for the name (assumes name, first and last, and title are all in proper case with 1st char being uppercase)::

Code:
=LEFT(A2,SMALL(IFERROR(FIND(CHAR(ROW($65:$90)),A2,2),""),2)-1)
 
Upvote 0
This might do it for the name (assumes name, first and last, and title are all in proper case with 1st char being uppercase)::

Code:
=LEFT(A2,SMALL(IFERROR(FIND(CHAR(ROW($65:$90)),A2,2),""),2)-1)
This helped with the name! thank you!!
 
Upvote 0
Unfortunately, we never got the 5-10 varied examples that I asked for so I don't really know what your data might look like but I suspect that the formulas suggested could turn up some strange results - see the coloured cells in the first section of the mini-sheet below where I have used those suggested formulas.

If any of those name circumstances could occur in your data then I suggest the following user-defined functions as an alternative approach, with results shown in the second section below.
Post back if you think this might be useful but are not sure how to implement UDFs
My assumption with the functions is that the persons position (eg Manager) is always one-word consisting of an upper-case letter followed by a number of lower-case letters with no special characters (eg hyphens). If that is not the case then please give details of what the positions could be.

VBA Code:
Function fPhone(s As String) As String
  Dim RX As Object
  
  Set RX = CreateObject("VBScript.RegExp")
  RX.Pattern = "\d{3}\-\d{3}\-\d{4}"
  fPhone = RX.Execute(s)(0)
End Function

Function fEmail(s As String) As String
  Dim RX As Object
  
  Set RX = CreateObject("VBScript.RegExp")
  RX.Pattern = "(\d{3}\-\d{3}\-\d{4})(.+?)(?=\d{2}\/)"
  fEmail = RX.Execute(s)(0).SubMatches(1)
End Function

Function fName(s As String) As String
  Dim RX As Object
  
  Set RX = CreateObject("VBScript.RegExp")
  RX.Pattern = "(^.+)(?=[A-Z][^A-Z]+\d{3}\-\d{3}\-\d{4})"
  fName = RX.Execute(s)(0)
End Function


RDH2022.xlsm
ABCD
1PhoneemailName
2Debra HillManager213-225-3576hill13503@sbcglobal.net05/30/2018, 9:53 AMJane Yong213-225-3576hill13503@sbcglobal.netDebra Hill
3John McDonaldManager213-225-3576hill13503@sbcglobal.net05/30/2018, 9:53 AMJane Yong213-225-3576hill13503@sbcglobal.netJohn Mc
4Debra Hill-JonesManager213-225-3576hill13503@sbcglobal.net05/30/2018, 9:53 AMJane Yongill-JonesManager213-225-3576hill13503@sbcglobal.netDebra Hill-
5Mary-Lou JonesManager213-225-3576hill13503@sbcglobal.net05/30/2018, 9:53 AMJane Yongary-Lou JonesManager213-225-3576hill13503@sbcglobal.netMary-Lou
6
7PhoneemailName
8Debra HillManager213-225-3576hill13503@sbcglobal.net05/30/2018, 9:53 AMJane Yong213-225-3576hill13503@sbcglobal.netDebra Hill
9John McDonaldManager213-225-3576hill13503@sbcglobal.net05/30/2018, 9:53 AMJane Yong213-225-3576hill13503@sbcglobal.netJohn McDonald
10Debra Hill-JonesManager213-225-3576hill13503@sbcglobal.net05/30/2018, 9:53 AMJane Yong213-225-3576hill13503@sbcglobal.netDebra Hill-Jones
11Mary-Lou JonesManager213-225-3576hill13503@sbcglobal.net05/30/2018, 9:53 AMJane Yong213-225-3576hill13503@sbcglobal.netMary-Lou Jones
Split Text
Cell Formulas
RangeFormula
B2:B5B2=MID(A2,SEARCH("???-",A2),12)
C2:C5C2=MID(A2,SEARCH("???-",A2)+12,SEARCH("??/",A2)-(SEARCH("???-",A2)+12))
D2:D5D2=LEFT(A2,SMALL(IFERROR(FIND(CHAR(ROW($64:$89)),A2,2),""),2)-1)
B8:B11B8=fPhone(A8)
C8:C11C8=fEmail(A8)
D8:D11D8=fName(A8)
 
Upvote 0

Forum statistics

Threads
1,215,490
Messages
6,125,094
Members
449,205
Latest member
ralemanygarcia

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