2 min read

How to extract domains from URLs in Excel

In the day to day of an SEO, it’s inevitable you’ll need to manipulate URLs to get what you need. Working with a large number of backlinks is a common occurrence and you may need to extract domains from the URLs to make data more digestible. Luckily this is very easy to do in Excel, read ahead to find out how!

In our worked example, we have pulled backlink data from Ahrefs for a popular website. As there are thousands of individual links, we want to quickly simplify the data and break down to domain level.

Now here’s the bit you care about…

I’m going to share with you two fast and easy methods to extract domains from URLs in Excel. Though you should definitely use method 2… (skip to method 2)

Method 1: Formula

1) Insert two new columns at the front of your data, so columns A and B are empty.

2) Copy and paste your backlinks into column A (steps 1 & 2 means you don’t have to tweak the formula), then add a heading ‘Domains’ in B1.

3) Enter the formula below into cell B2

=IF(ISERROR(FIND("//www.",A2)), MID(A2,FIND(":",A2,4)+3,FIND("/",A2,9)-FIND(":",A2,4)-3), MID(A2,FIND(":",A2,4)+7,FIND("/",A2,9)-FIND(":",A2,4)-7))

 

formula to extract domain from url

4) Copy and paste this down / Fill handle (this formula will extract the domain from URLs for all scenarios e.g. ‘http’, https’ or ‘www.’)

5) Copy and paste values to remove formula

fill handling formula to get domains from URLs

And there you have it! You will now have a clean column of domains.

Method 2: Find & Replace Wildcard*

(my favourite method)

Using a wildcard in conjunction with Find & Replace is a gamechanger! With just a couple of quick replaces, your URLs will be tidied, without needing to remember or dig out a dirty long formula like the above.

1) Add a second column next to your backlink data and copy and paste the first column into second so you’ve got two identical columns.

duplicate column preparation for extracting domains from URLs

2) Highlight the second column, then press CTRL + F (Windows) or CMD + F (Mac), then click ‘Replace…’

Here’s the trial and error part, you’ll want to first remove the protocol at the front of the URL, and then the path after the domain. The following steps will clear up every possible URL scenario in 3 simple steps.

3) Here’s the trial and error part, you’ll want to first remove the protocol at the front of the URL, and then the path after the domain. The following steps will clear up every possible URL scenario in 3 simple steps:

1) *www.

2) *://

3) /*

 

find and replace to extract domains from urls in excel

Done! You’ve successfully extracted domains from your list of URLs. Simple right?

Should you want to get really crafty, check out our article on how to extract domains using python for a clear and easy guide.

Want to learn more? Keep an eye on our blog as we’ll be sharing more helpful Excel tips or follow us on Twitter.

 

Explore Our Services

DIGITAL PR 

Earn authoritative links and drive brand awareness with Digital PR

PAID SEARCH

Deliver instant traffic and revenue through Paid Search and Shopping

SOCIAL ADS

Reach new audiences and retarget existing ones on social channels 

CONTENT

Attract and engage website visitors with a well executed content strategy

Latest Blog Posts

Honchō Scoops Up Two UK Search Awards!

3 min read

Honchō Scoops Up Two UK Search Awards!

It’s official, we've added not one, but two shiny trophies to our awards cabinet! We’re over the moon to share that we’ve triumphed at the UK Search...

Read More
The Best Ecommerce Attribution Models for Your Brand

5 min read

The Best Ecommerce Attribution Models for Your Brand

Understand ecommerce attribution models which attribution models can maximise your marketing efforts and ROI.

Read More
The Role of Social Commerce in Ecommerce

3 min read

The Role of Social Commerce in Ecommerce

Explore how social commerce is changing the way we shop online, blending social interactions with digital commerce for a seamless buying experience.

Read More