2

I am trying to extract contact names of a data set, however, the names are compiled in one cell and not split up by first name, middle name, last name, email, etc.

I only need to get their names because I already have a data set only with their emails, NOT their names.

How do I extract multiple case-sensitive words and split into cells?

Here's how it looks like in one cell:

See screenshot here

I've tried several codes I've found online and this is the only thing that comes close, however, it still extracts unnecessary lower case letters which I don't need. Please help, I'm no expert with these kinds of things.

=TRANSPOSE(SPLIT(TRIM(SUBSTITUTE(REGEXREPLACE(REGEXREPLACE(REGEXREPLACE( A2,"\b\w[^A-z]*\b"," "),"\W+"," "),"[0-9]+","")," m "," "))," "))

I expect them to have the first, middle, last names to be split into new columns like this:

Tom   Billy   Claudia   Downey   Karen   Dicky   Steve   Harvey

OR

Tom Billy  Claudia Downey  Karen Dicky  Steve Harvey
player0
  • 124,011
  • 12
  • 67
  • 124
Ahnaf
  • 45
  • 3

2 Answers2

1
=ARRAYFORMULA(TRIM(IFERROR(REGEXREPLACE(IFERROR(REGEXEXTRACT(IFERROR(SPLIT(A2:A, 
 CHAR(10))), "(.*) .*@")), "Mr. |Mrs. ", ""))))

0

player0
  • 124,011
  • 12
  • 67
  • 124
  • 1
    Thank you so much, this worked beautifully. However, could you please check out my recent question as well? It's related to this one, now I just need to transpose it, but I tried several codes and I can't seem to figure it out... – Ahnaf Jun 06 '19 at 14:32
0

This formula might help. i have added the conditions to replace the email id and Mr./Ms. conditions.

=TRANSPOSE(SPLIT(TRIM(SUBSTITUTE(REGEXREPLACE(REGEXREPLACE(REGEXREPLACE(    
REGEXREPLACE(REGEXREPLACE(A2,"([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z] 
{2,5})",""),"\w+[\\.]+(?)",""),"\b\w[^A-z]*\b"," "),"\W+"," "),"[0-9]+","")," m "," 
"))," "))
shabnam bharmal
  • 589
  • 5
  • 13