You might have a list of URLs in Excel and want to extract the domain names from that list. This would be time-consuming without automation. Here is a formula that can help you get a domain name from URLs.
Excel Formula to Get Domain Name from URL
=LEFT (url, FIND ("/", url, 9))
Sometimes, it becomes very complex to separate the domain names from their respective URLs, specifically, when you have a huge list of URLs to extract domain names from. Fortunately, excel formula, based on LEFT and FIND, simplifies this hectic task for you to get a domain name from URL.
In the basic formula above, the term URL is the actual URL you are looking to extract. We are using the following formula in the example:
=LEFT (B5, FIND ("/", B5, 9))
Figure 1. Example of a formula to get a domain name from URL
How This Formula Works
B5 contains the URL: “https://www.thesaurus.com/browse/excel“
First, the formula extracts characters starting from the left side of the URL. Here, the FIND function is used to check the number of characters required to extract.
All the URLs start with a protocol to transfers information. Given below are some of the protocols:
FIND pinpoints the location of the “/” in the URL. The process starts with the 9th character, as defined in the formula, skipping the protocol. As a result, the location of the third specimen of “/” is identified.
In the given URL in B5 cell, the location of the third “/” is at the 26th character of the URL, so, we’ll get the number 26.
In the end, 26 characters are extracted from the URL by the LEFT function, from the left side, and you get your desired result-the Domain Name.
For the elimination of the last slash from the domain name, you can subtract the number 1 from the result. Please refer to the formula below for a clear instance.
=LEFT (B4, FIND ("/", B5, 9)-1)
Thus, this simple formula can help you get the domain name from URL. You can, perhaps, extract hundreds and thousands of domain names from the URLs within no time.
Still need some help with Excel formatting or have other questions about Excel? Connect with a live Excel expert here for some 1 on 1 help. Your first session is always free.