Go Back

How to Get the Top Level Domain (TLD) from Data in Excel

The Top Level Domain (TLD) refers to the last part of the full domain name or URL that follows after the dot “.” symbol, like .com, .net, .org etc. We can extract the top level domain from the full domain name or email address using a formula that consists of several text functions, like RIGHT, LED, FIND and SUBSTITUTE functions.

Figure 1. Extract Top Level Domain From URL

Formula Syntax

The generic formula syntax is:

=RIGHT(domain,LEN(domain)-FIND("*",SUBSTITUTE(domain,".","*",LEN(domain)-LEN(SUBSTITUTE(domain,".","")))))

Here “domain” refers to the full domain name or URL or email address as a cell reference or text value directly entered in this formula syntax. Suppose we have a list of domains containing URLs in column C and want to get the top level domain (TLD) from the full domain name in column D. As per the formula syntax, we need to use the following formula in cell D2;

=RIGHT(C2,LEN(C2)-FIND("*",SUBSTITUTE(C2,".","*",LEN(C2)-LEN(SUBSTITUTE(C2,".","")))))

Figure 2. The Formula to Extract Top Level Domain From URL

Working of the Formula

In this formula, we have used the RIGHT function to extract the number of characters from the right side of the domain name. The following part of the formula returns the number of characters in the RIGHT function as per the location of the last dot “.” position in the URL string;

LEN(C2)-FIND("*",SUBSTITUTE(C2,".","*",LEN(C2)-LEN(SUBSTITUTE(C2,".",""))))

In order to locate the position of last “dot” symbol in the string, we need to first replace the last “dot” symbol with asterisk “*” in the following formula part, and then FIND function returns the location of the asterisk in the string;

SUBSTITUTE(C2,".","*",LEN(C2)-LEN(SUBSTITUTE(C2,".","")))

We can select this formula part in the formula bar and press the F9 key to see the result.

Figure 3. Replacing the Last Dot Symbol With Asterisk

Then the FIND function returns the position of the asterisk to calculate the number of characters required to extract from the full domain name. The following formula part calculates the number of characters by subtracting the position of the asterisk symbol from the total characters of the domain;

LEN(C2)-FIND("*","www.google*com")

As the total characters’ length in cell C2 is 14 and FIND function returns the position of asterisk symbol at 11th character, so the resulting number of characters would be 3 (14-11) to feed into the RIGHT function. Select the above part of the formula and press F9 again to see the result.

Figure 4. Calculating the Number of Characters Required

Finally, the RIGHT function extracts the number of characters from the right side of the domain name return by the remaining part of the formula. Press Enter and copy the formula down to other cells if required.

Figure 5. Final Preview of Formula Result

Instant Connection to an Expert through our Excelchat Service

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

I need to find top values within subset eg: Within a District, at mandal level, at village level - top values
Solved by T. Y. in 28 mins
Only want data for top level row in pivot table
Solved by A. E. in 22 mins
Hi can you help me to get company domain look up from company name
Solved by K. J. in 11 mins

Leave a Comment

avatar