How To Extract Domain Names From URLs In Microsoft Excel

How To Extract Domain Names From URLs In Microsoft Excel

Introduction

Microsoft Excel is one of the most powerful tools for organizing, cleaning, and analyzing data. Whether you work in digital marketing, SEO, website management, sales research, or data reporting, you may often deal with long lists of URLs. In many cases, you do not need the full webpage address. Instead, you may only want the domain name, such as example.com, from a full URL like https://www.example.com/blog/page. Extracting domain names from URLs in Excel can help simplify data analysis, improve reporting accuracy, and make large datasets easier to manage.

For example, if you are analyzing backlinks, tracking referral sources, or cleaning website data, separating domain names from complete URLs can save a lot of time. Fortunately, Excel provides several effective ways to perform this task, including formulas, Flash Fill, Power Query, and modern functions available in newer versions.

Update Windows Drivers

This guide explains how to extract domain names from URLs in Microsoft Excel using multiple methods. Whether you are a beginner or advanced Excel user, you will find the right solution for your needs.

Understanding the Structure of a URL

PC running slow or unstable? Do you want to update drivers?

Before extracting domain names, it is helpful to understand how URLs are structured. A typical URL contains several components:

  • Protocol: https:// or http://
  • Subdomain: www or blog
  • Domain name: example.com
  • Path: /page/article
  • Parameters: ?id=123

For example, in the URL:

https://www.example.com/blog/article?id=10

The main domain is:

example.com

Your goal in Excel is to isolate the important domain section while removing unnecessary parts such as protocols, paths, and parameters.

Why Extract Domain Names in Excel?

There are many practical reasons for extracting domains:

  • SEO competitor analysis
  • Website traffic source tracking
  • Cleaning exported marketing data
  • Organizing customer website information
  • Identifying duplicate websites
  • Simplifying URL reports
  • Sorting websites by domain
Repair PC

By extracting only the domain, your spreadsheet becomes cleaner and easier to analyze.

Method 1: Using Traditional Excel Formulas

One of the most common ways to extract domain names is through built-in text formulas. This method works in most Excel versions.

PC running slow or unstable? Do you want to update drivers?

Assume your URL is in cell A2.

Formula:

=LEFT(MID(A2,FIND("//",A2)+2,LEN(A2)),FIND("/",MID(A2,FIND("//",A2)+2,LEN(A2))&"/")-1)

How It Works:

  • FIND("//",A2) locates the protocol separator
  • MID removes the protocol
  • FIND("/",...) identifies where the domain ends
  • LEFT extracts the domain portion

Example:

If A2 contains:

https://www.google.com/search?q=excel

The result will be:

www.google.com

This method is reliable but can look complicated for beginners.

Method 2: Removing “www” from Extracted Domains

Sometimes, you may want cleaner domains without “www.”

Formula:

=SUBSTITUTE(B2,"www.","")
PC running slow or unstable? Do you want to update drivers?

If B2 contains:

www.google.com

The result becomes:

google.com

This helps standardize domain lists for analysis.

Method 3: Using TEXTBEFORE and TEXTAFTER (Excel 365/2021)

Modern Excel versions include simpler text functions.

Formula:

=TEXTBEFORE(TEXTAFTER(A2,"//"),"/")

Benefits:

  • Easier to read
  • Faster to create
  • Better for beginners
  • More efficient for large datasets

Example:

Input:

https://blog.microsoft.com/news

Output:

blog.microsoft.com

You can also combine with SUBSTITUTE:

=SUBSTITUTE(TEXTBEFORE(TEXTAFTER(A2,"//"),"/"),"www.","")

Final result:

microsoft.com

Method 4: Extracting Root Domains Only

If URLs contain subdomains like blog.example.com, you may want only example.com.

This can be more challenging because domain structures vary.

Simple Formula Example:

=RIGHT(B2,LEN(B2)-FIND("@",SUBSTITUTE(B2,".","@",LEN(B2)-LEN(SUBSTITUTE(B2,".",""))-1)))

This helps isolate the main domain in many cases.

Use Cases:

  • Competitor website grouping
  • SEO audits
  • Referral source analysis
  • Brand-level reporting

Note that country-specific domains like .co.uk may require additional customization.

Method 5: Flash Fill for Quick Domain Extraction

Excel’s Flash Fill can automatically detect patterns.

Steps:

  1. Enter the desired domain manually in the adjacent column
  2. Start typing the next result
  3. Excel may suggest auto-fill
  4. Press Enter

Advantages:

  • No formulas needed
  • Fast for small datasets
  • User-friendly

Limitations:

  • Less reliable for inconsistent URLs
  • Manual starting input required
  • Not ideal for automation

Flash Fill works best for simple domain extraction tasks.

Method 6: Power Query for Large Datasets

Power Query is one of the best options for processing thousands of URLs.

Steps:

  1. Select your URL column
  2. Go to Data > From Table/Range
  3. Open Power Query Editor
  4. Select the URL column
  5. Use Split Column by Delimiter
  6. First split by “//”
  7. Then split by “/”
  8. Keep the domain column
  9. Remove “www” if needed
  10. Load data back into Excel

Benefits:

  • Excellent for bulk processing
  • Repeatable automation
  • Minimal formulas
  • Easy refresh for new data

Best For:

  • SEO exports
  • Marketing reports
  • CRM cleanup
  • Large business datasets

Handling URLs Without HTTP or HTTPS

Not all URLs include protocols.

Example:

www.example.com/page

Traditional formulas may fail if “//” is missing.

Alternative Formula:

=LEFT(A2,FIND("/",A2&"/")-1)

This extracts domains even without protocols.

Result:

www.example.com

Always inspect your dataset format before selecting a formula.

Dealing with Parameters and Tracking Codes

URLs often include tracking information:

https://example.com/page?utm_source=google

The extraction methods above typically stop before parameters, preserving only the domain.

This ensures cleaner outputs for analysis.

Common Errors When Extracting Domains

#VALUE! Error

Occurs when expected delimiters are missing.

Fix:

Use IFERROR:

=IFERROR(TEXTBEFORE(TEXTAFTER(A2,"//"),"/"),A2)

Inconsistent URL Formatting

Some rows may contain:

  • https://
  • http://
  • www
  • no protocol

Solution:

Normalize data first using SUBSTITUTE or helper columns.

Best Practices for Domain Extraction

Standardize URLs First

Convert all URLs into similar formats before extraction.

Remove Unnecessary Prefixes

Strip:

  • http://
  • https://
  • www.

Validate Results

Check for:

  • Missing domains
  • Duplicate entries
  • Incorrect subdomains

Use Modern Functions When Possible

TEXTBEFORE and TEXTAFTER are easier and more efficient.

Use Power Query for Scale

For enterprise-level tasks, Power Query saves significant time.

Comparing Excel Methods

Traditional Formula

Pros:

  • Compatible with older versions
  • Flexible

Cons:

  • Complex syntax
  • Harder to maintain

TEXTBEFORE/TEXTAFTER

Pros:

  • Simple
  • Modern
  • Easy to understand

Cons:

  • Requires newer Excel versions

Flash Fill

Pros:

  • Beginner-friendly
  • Quick

Cons:

  • Manual
  • Less consistent

Power Query

Pros:

  • Excellent for large data
  • Automated
  • Repeatable

Cons:

  • Learning curve

Advanced Applications

SEO Audits

Extract domains from backlink lists to identify linking websites.

Marketing Reports

Analyze traffic sources by domain.

Competitor Monitoring

Track mentions from competitor domains.

Customer Databases

Separate website addresses for cleaner CRM data.

Web Scraping Cleanup

Organize scraped URLs into manageable datasets.

Troubleshooting Special Cases

Country Code Domains

Examples:

  • example.co.uk
  • company.com.au

These may require custom formulas because root domains vary.

Broken URLs

Missing slashes or malformed structures may require cleanup before extraction.

Subdomains

If subdomains matter, keep them.

If not, remove them using additional formulas.

Final Thoughts

Extracting domain names from URLs in Microsoft Excel is an essential skill for anyone working with online data. Whether you are managing SEO campaigns, organizing website lists, cleaning customer information, or analyzing marketing reports, domain extraction helps simplify complex datasets.

For most users, TEXTBEFORE and TEXTAFTER offer the easiest modern solution. Traditional formulas remain useful for older Excel versions, while Power Query is ideal for large-scale projects. Flash Fill can be a quick shortcut for smaller tasks.

By understanding URL structures and choosing the right extraction method, you can significantly improve productivity, reduce manual work, and create more organized spreadsheets.

Excel’s flexibility makes it a powerful tool for domain extraction, and mastering these techniques can save hours of repetitive effort.

Frequently Asked Questions

How do I extract a domain name from a URL in Excel?

You can use formulas like TEXTBEFORE/TEXTAFTER in Excel 365 or traditional FIND, MID, and LEFT formulas in older versions.

What is the easiest formula for domain extraction?

=TEXTBEFORE(TEXTAFTER(A2,"//"),"/")

Can Excel remove subdomains automatically?

Yes, but advanced formulas or Power Query may be needed depending on URL complexity.

Is Power Query better than formulas?

For large datasets, Power Query is often faster, cleaner, and easier to automate.

Can Flash Fill extract domains?

Yes, Flash Fill works for simple and consistent URL patterns but may not be reliable for all cases.

Yes, most formulas can handle both formats, especially after standardizing URLs.

PC running slow or unstable? Do you want to update drivers?

GeeksDigit.Com
Logo