Sometimes, you might need to collect the domain names from a long list of webpage URLs. This post will show you how to extract domain names from URLs using Microsoft Excel. This can be useful if you are planning to make a Disavow File for submission to Google. It is quite easy, and you can do that with the help of an Excel formula.
Let’s assume you have a list of webpage URLs of various websites, and you need to extract only the naked domain names (e.g., thewindowsclub.com). If the file is small, you can do that manually. However, it can be time-consuming work if the list contains hundreds of URLs. Instead of doing manual labor, you can take the help of this guide, where you will learn the process to remove additional parts from a URL and keep the domain name only.
Extract domain names from URLs using Excel
There are two main formulas that you need to use. The first formula will let you get the full domain name, which includes www (e.g., www.thewindowsclub.com). The second one will remove www (e.g., thewindowsclub.com) and show you the domain name only.
1] Extract domains with WWW
First, open the URL list in Microsoft Excel. If you have it in a .txt or .csv file, you can follow this tutorial to convert a Text file into an Excel spreadsheet. Once you have got the list, you need to specify a column where you want to display the domain names. For your convenience, you can create a column, and name it as “Domain,” or something like that. After that, select the first cell of the Domain column, and enter this formula-
=MID(A2,FIND(":",A2,4)+3,FIND("/",A2,9)-FIND(":",A2,4)-3)
According to this formula, A2 cell is your source, and the selected cell of the Domain column should display the domain name with WWW.
2] Get domain names with WWW
Sometimes, you might need only domain names for various purposes. If so, the following formula will do the job.
=IF(ISERROR(FIND("//www.",A2)), MID(A2,FIND(":",A2,4)+3,FIND("/",A2,9)-FIND(":",A2,4)-3), MID(A2,FIND(":",A2,4)+7,FIND("/",A2,9)-FIND(":",A2,4)-7))
This extracts the domain name of one URL at a time. If you want to do the same with all the URLs, you need to follow the following step.
For your information, these functions do not extract all URLs at once since you need to specify the cell number in these formulas. However, you do not need to enter the entire function every time. Instead of that, you can use your mouse to get the job done.
Select a cell where you applied the function to extract the domain name. You should see a small dot at the bottom-right corner. You need to click this button and drag it towards the bottom cells. You can see the result as you pull the dot.
After getting the domain names, you might want to save it in a different spreadsheet. The next problem is that you cannot copy the domain names using Ctrl+C and Ctrl+V directly. Although you can do that by pasting the domain names in Notepad or something, an error will be displayed when doing the same in a spreadsheet.
To get rid of that problem, you need to select all the domain names that you want to copy, select a different column or spreadsheet, expand the Paste option in the Home tab, and select Values under the Paste Values section.
That’s all. Now, you can use those values or domain names to do further jobs.
I hope this tutorial will help you.
To make a Disavow File, you need to add the text “domain:” in front of all the domains now. This post will show you how to add a prefix to a range of cells in Excel.