Extract 2 email addresses from a string of text

test_man2

New Member
Joined
Aug 28, 2007
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Greetings!

Back in 2006, fairwinds posted a solution to extract an email address from a string of text:
=TRIM(MID(SUBSTITUTE(" "&A1," ",REPT(" ",20)),FIND("@",SUBSTITUTE(" "&A1," ",REPT(" ",20)))-20,40))

What if that string of text contains two email addresses? Such as - "Update abcdefg@gmail.com to tuvwxyz@att.net"

My guess is that the best way would be to create a new formula in column C (the above formula being in column B). What would that formula be?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,380
Office Version
  1. 365
Platform
  1. Windows
How about
+Fluff 1.xlsm
ABC
1
2Update abcdefg@gmail.com to tuvwxyz@att.netabcdefg@gmail.comtuvwxyz@att.net
3Update tuvwxyz@att.nettuvwxyz@att.net
Lists
Cell Formulas
RangeFormula
B2:C2,B3B2=TRANSPOSE(FILTERXML("<k><m>"&SUBSTITUTE(A2," ","</m><m>")&"</m></k>","//m[contains(.,'@')]"))
Dynamic array formulas.
 
Solution

test_man2

New Member
Joined
Aug 28, 2007
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Wow, that's great! If only you could clearly explain to me step-by-step how this works! I've never seen a formula extend results across more than one cell! Alas, I know little to nothing about dynamic array formulas, and I've never seen a formula with FILTERXML in it, so any explanation you provide would probably just go way over my head! My line of thinking was perhaps somehow using RIGHT in a formula in column C, which would only work if the address were at the end of the string, but yours works no matter where they are. Thanks for the solution!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,380
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Forum statistics

Threads
1,141,286
Messages
5,705,517
Members
421,399
Latest member
hjweiss00

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
Top