I promise I’ll never do this again. Really, I do.
I may have mentioned previously, that I spend entirely too much time with Excel. Well it’s true, I do. I hope to stop soon. Actually, I meant to stop a long time ago. So anyway, let me share one of the fruits of my misery.
This formula will extract an email address out of a text string of any length, regardless of where in the text string the email address is located. It will always take the first email address found and no others. The formula will return an error if none is found. The example provided, assumes that the string is in cell A2. Adjust accordingly.
=IF(ISERR(LEN(LEFT(A2,SEARCH(”@”,A2)))-FIND(”*”,SUBSTITUTE(LEFT(A2,SEARCH(”@”,A2)),” “,”*”,LEN(LEFT(A2,SEARCH(”@”,A2)))-LEN(SUBSTITUTE(LEFT(A2,SEARCH(”@”,A2)),” “,”"))))),LEFT(A2,FIND(”@”,A2)),RIGHT(LEFT(A2,SEARCH(”@”,A2)),LEN(LEFT(A2,SEARCH(”@”,A2)))-FIND(”*”,SUBSTITUTE(LEFT(A2,SEARCH(”@”,A2)),” “,”*”,LEN(LEFT(A2,SEARCH(”@”,A2)))-LEN(SUBSTITUTE(LEFT(A2,SEARCH(”@”,A2)),” “,”"))))))&IF(ISERR(FIND(” “,RIGHT(A2,LEN(A2)-FIND(”@”,A2)))),RIGHT(A2,LEN(A2)-FIND(”@”,A2)),LEFT(RIGHT(A2,LEN(A2)-FIND(”@”,A2)),FIND(” “,RIGHT(A2,LEN(A2)-FIND(”@”,A2)))))
Why would you ever use this? Well, if you had any sense you wouldn’t. Sense and sensibility are not my province, however.
Again, enjoy this crap while you can, I’ll never do it again.