This post is going to show you all the ways you can get the URL from a hyperlink in Microsoft Excel! A hyperlink is a link that allows users to navigate to a web page or document. Hyperlink cells typically contain a URL, which is the address of the linked page or document, and anchor text, which is the text that appears on the screen and is clicked by the user. When the hyperlink uses anchor text, the actual URL isn’t easily accessible in Excel but you may need this data for other purposes. Follow this easy step-by-step guide on how to extract the URL from a hyperlink in Microsoft Excel.
Extract the Hyperlink URL with a Click
This is the most obvious method to get the URL from any hyperlink. When you click on the hyperlink, Excel will launch your internet browser and take you to the website URL. You can then copy and paste the URL from the browser address bar back into Excel. Highlight the URL and press Ctrl + C to copy, then go back to Excel and press Ctrl + V to paste the URL into a new cell. Unfortunately, this is a very manual approach that involves switching back and forth between two applications. There are definitely easier methods!
Extract the Hyperlink URL from the Insert Menu
A slightly easier way to get the URL from your hyperlinks is through the Link command found in the Insert menu. Follow these steps to extract the URL from the Link command. This will open the Edit Hyperlink menu which contains both the anchor text and the URL address data. You now have the URL from the hyperlink!
Extract the Hyperlink URL with a Right Click
You can also access the Edit Hyperlink menu with a right-click to avoid using the ribbon commands. This will open the Edit Hyperlink menu and you can copy and paste the URL from the Address as before.
Extract the Hyperlink URL with a Keyboard Shortcut
Using a keyboard shortcut to open the Edit Hyperlink menu is slightly quicker than the previous methods for getting the URL. This is my favorite method when I only need to extract a couple of URLs from their hyperlinked cells. Select the cell containing the hyperlink and press Ctrl + K to open the Edit Hyperlink menu. This will open the Edit Hyperlink menu and you can copy and paste the URL from the Address just like before.
Extract the Hyperlink URL with VBA
If you work with hyperlinks in Excel, you know that it can be a tedious task to extract the URL from each hyperlink. To save yourself time and effort, you can use VBA to automate the process. With just a few lines of code, you can extract the URL from multiple hyperlinks in Excel. Not only does this save you time, but it also ensures the results are accurate as manual processes tend to lead to errors. Follow these steps to create a VBA macro to extract the URL from your hyperlinks. The code will loop through all of the hyperlinks in the selected range and extract the URL from each into the adjacent cell. Now you can extract URL’s from multiple hyperlinks! Follow these steps to extract multiple URL’s using the VBA macro. The code will run and place the URL in the adjacent cell! Just make sure the adjacent cells don’t already contain any data or formulas as the code will overwrite anything in the cells directly to the right.
Extract the Hyperlink URL with a Custom Function
Another way you can leverage VBA to extract the URL is through a custom function. This will allow you to get a dynamic solution, so if the hyperlinks change, the extracted URL will also update accordingly. Add the above code into the VBE. This code will create a custom function that returns the URL from a hyperlink. This custom function can then be used in your worksheet just like any other function. Insert the above formula into your worksheet and it will return the URL from the referenced hyperlink.
Extract the Hyperlink URL with Office Scripts
VBA isn’t the only way to automate your work in Excel! You can also use Office Scripts. It’s a TypeScript based language available in business plans of Microsoft 365 with Excel Online. Follow these steps to create an Office Script that extracts the URL from your hyperlinks. This will open the code editor on the right hand side. Now you will be able to extract the URL’s from any range of hyperlinked cells. This Office Script will loop through the selected range and place the URL from the hyperlink into the adjacent cell.
Conclusions
If you work with hyperlinks in Excel, you may sometimes need to extract the URL from those hyperlinks. There are many different ways to extract the URL from a hyperlink in Microsoft Excel. The most straightforward way is to either click the link and get the URL in the browser or use the Edit Hyperlinks menu. This is ok when you only need to get the URL from a few hyperlinks and it’s an activity you won’t be doing frequently. Otherwise, you will need to automate the process to avoid the tedious work involved! Thankfully, you can automate URL extraction with VBA or Office Scripts in order to get URL’s from multiple hyperlinks. Extracting the URL from a hyperlink in Excel is a quick and easy process, and the VBA or Office Script solutions will save you tons of time and effort when working with a lot of hyperlink data. Give it a try next time you need to extract a URL from a hyperlink in Excel! Let me know in the comments section below how it goes!