How to Extract Domain Names from URLs in Excel



Updated November 2024: Stop getting error messages and slow down your system with our optimization tool. Get it now at this link
  1. Download and install the repair tool here.
  2. Let it scan your computer.
  3. The tool will then repair your computer.

If you are always dealing with many URLs in your workbook, you should sometimes extract only the domain name of each web page. How can I quickly find domain names from URLs in Excel?

People who work with the internet and websites have an infinite database to manage. When your boss hands you a file (from whatever source) containing thousands of URLs and tells you to “manage this data”, the first task is to extract the domain names from the URLs.

Extract the Domain Name from the URL with the Formula

The following long formula can help you to restore the website domain name as you need it. Please proceed as follows:

Enter the following formula in an empty cell next to the cell of your web page In this example, I will enter the formula in cell B2:

=IF(ISNUMBER(FIND("www.",A2)),MID(A2,FIND("www.",A2)+4,IF(ISNUMBER(FIND("/",A2,9)),FIND("/",A2,9),LEN(A2)+1)-FIND("www.",A2)-4),MID(A2,FIND("//",A2)+2,IF(ISNUMBER(FIND("/",A2,9)),FIND("/",A2,9),LEN(A2)+1)-FIND("//",A2)-2)).

Note In the above formula, A2 indicates the cell that contains the Web page whose domain name you want to obtain. You can change it if necessary.

Then press the Enter key and select cell B2, drag the fill handle down to the area where you want to apply this formula, and all domain names are extracted from each URL.

November 2024 Update:

You can now prevent PC problems by using this tool, such as protecting you against file loss and malware. Additionally, it is a great way to optimize your computer for maximum performance. The program fixes common errors that might occur on Windows systems with ease - no need for hours of troubleshooting when you have the perfect solution at your fingertips:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.

Download Now

To extract the Domain Name from a URL that does not Contain HTTP(S)

=MID(A2,SEARCH("://",A2)+3,SEARCH("/",A2,9)-SEARCH("://",A2)-3)

Starting from the center (MID) of cell A2, find the first occurrence of a specific character (here “://”) in cell A2. Add +3 characters to the return value of the search formula (this way, the double slash is omitted). The second step is to search for another specific character (here “/”) in cell A2 starting with the 9th character (this way, the protocol bit is omitted up to the first two slashes). Finally, subtract (-) the returned value from a search for “://” in cell A2 and delete (-) the last three characters of the returned value.

To Extract the Domain Name from a URL that does not Contain HTTP(S) and www

=MID(SUBSTITUTE(A2,"www.",""),SEARCH(":",A2)+3,SEARCH("/",SUBSTITUTE(A2,"www.",""),9)-SEARCH(":",A2)-3)

Starting from the center (MID) of a text string, SUBSTITUTE in cell A2 the subdomain “www” with nothing (“””). Find the first occurrence of “:” in cell A2. Add +3 characters to the returned value (omitting the double slash). Perform a second SEARCH, this time looking for “/” in the returned value when you enter the subdomain “www” with nothing (“””) SUBSTITUTE in cell A2, and specify that the search should start from the 9th character (again omitting the protocol bit and up to the first two slashes). Finally, subtract (-) the returned value of a search from “://” in cell A2 and remove (-) the last 3 characters of the returned value.

https://www.pcworld.com/article/3159983/create-custom-email-addresses-and-extract-domain-names-from-urls.html



Expert Tip: This repair tool scans the repositories and replaces corrupt or missing files if none of these methods have worked. It works well in most cases where the problem is due to system corruption. This tool will also optimize your system to maximize performance. It can be downloaded by Clicking Here

Scroll to Top