0

This is the content of the cell and several like this. I need to extract only the email addresses.

1

This is the function that I have so far:

=arrayformula(regexextract(query(split( transpose(split(A1, ",")), ":" ),"select Col2 where Col1 contains 'email' ",0),"\w.+\w"))

I have more than one cell with the info when I applied this function I am not able to drag down the function.

3
  • Welcome again to Web Applications Stack Exchange. See How do I ask a good question? Commented Aug 15, 2022 at 19:10
  • Have you tried searching stack exchange for similar questions?
    – Blindspots
    Commented Aug 17, 2022 at 0:02
  • This is several days old. If you'd like additional input, A.) please respond to doubleunary below and B.) share a link to a copy of the spreadsheet with realistic data already entered for a few rows in Col A. I think I understand what you are trying to do, but it is not reasonable to expect the volunteers here to type out complex data into our own spreadsheets before even beginning to think through how to solve the issue. Help us to help you: share a link to a spreadsheet.
    – Erik Tyler
    Commented Aug 19, 2022 at 3:18

2 Answers 2

0

Use split(), regexextract() and join(), like this:

=arrayformula( 
  join( 
    ", ", 
    regexextract( 
      query( 
        split( transpose(split(A1, ",")), ":" ), 
        "select Col2 where Col1 contains 'email' ", 
        0 
      ), 
      "\w.+\w" 
    ) 
  ) 
)
0
0

REGEXREPLACE & REGEXEXTRACT

=INDEX(TOCOL(LET(
   str,REGEXREPLACE(TOCOL(A:A,1), "[{\[\]}""]", "¥"),
   REGEXEXTRACT(str, REGEXREPLACE(
     str, "mail¥:¥(.*?)¥", "mail¥:¥($1)¥"))),1))

INDEX  LET  REGEXEXTRACT  REGEXREPLACE  TOCOL

  1. str stores the strings after replacing any quotation marks ", brackets [], and braces {} with ¥, an arbitrarily chosen character that must meet the following two conditions:
    1. It won't be found in the source data
    2. It doesn't need to be escaped in regular expressions.
  2. REGEXREPLACE inserts parentheses around any email addresses in str.
  3. REGEXEXTRACT uses the string created in step #2 as a regular expression to extract the email addresses from str
  4. The formula is wrapped in TOCOL to convert the rows of email addresses to a single column. It can optionally be excluded.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.