How to Extract Domain Names from URLs in Excel



RECOMMENDED: Click here to fix Windows errors and optimize system performance

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.



January 2021 Update:

We now recommend using this tool for your error. Additionally, this tool fixes common computer errors, protects you against file loss, malware, hardware failures and optimizes your PC for maximum performance. You can fix your PC problems quickly and prevent others from happening with this software:

  • 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



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



RECOMMENDED: Click here to troubleshoot Windows errors and optimize system performance