< Go Back

How to Get a Domain Name from a URL in Excel

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

Basic Formula

=LEFT (url, FIND ("/", url, 9))

Formula Explanation

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.

Example

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:

https://

http://

ftp://

sftp://

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. 

Our customers love us!
“The expert was absolutely amazing and stuck with me the whole way through. They were polite, patient, seemed to want to genuinely help me and provided a solution that I would never have managed otherwise. I could not be more thankful for their support and solution. Thank you!” - - Chris T, in California
This blog is one way to figure it out. A 20 minute chat session with an expert is a better way.Get step-by-step guidance on your question

Leave a Comment

avatar