Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Extracting E-mail Addresses from Hyperlinks.
by Allen Wyatt
(last updated July 30, 2016)
Do you have a worksheet that has a bunch of e-mail addresses in it, as a series of hyperlinks? If so, you may be interested in a way to pull out those addresses and put them into cells as plain text. There are a few ways you can perform this task.
The first method is to remember that the hyperlinks for e-mail addresses all start with the text "mailto" followed by a colon. Thus, you can use a formula that will strip out the first part of the hyperlink. For instance, if the e-mail hyperlink is in cell A1, you can use this formula:
This checks the length of the cell contents, and then extracts all of it except the first seven characters, which is the "mailto:" portion. You could also use a formula that relies on the SUBSTITUTE function:
If you prefer, you can use a macro to do the conversion from hyperlink to text-only e-mail address. The following single-line macro is a user-defined function that returns the converted hyperlink:
Function ExtractEmailAddress(rCell As Range) ExtractEmailAddress = _ Mid(rCell.Hyperlinks(1).Address, 8) End Function
In order to use the macro, all you need to do is use the function in some cell of your worksheet, in this manner:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12000) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Extracting E-mail Addresses from Hyperlinks.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
When you copy information from a Web page and paste it into a worksheet, you can end up with more than you bargained for. ...Discover More
When you add a hyperlink to a worksheet, it consists of a minimum of two parts: display text and URL address. If you have a ...Discover More
In Excel, a hyperlink consists of two parts: the text displayed for the link and the target of the link. You can use a macro ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.