The profound rantings of the one like Tom Atkinson… and now art gallery and shop.

MS Excel function to convert URL into domain name

This function can be used to convert a URL such as http://www.funk.co.nz/ into just www.funk.co.nz

Here it is:

=LEFT(RIGHT(C5,(LEN(C5)-7)),(SEARCH("/",RIGHT(C5,(LEN(C5)-7)))-1))

Where cell C5 contains the URL, this formula should output just the domain name. If the URL is secure, you will need to increase the -7 to a -8 (http:// is 7 chars, whereas https:// is 8 chars).

Note: My blog software is converting the quotes so you will need to re-type the quote marks in the centre of the formula after pasting into Excel.

Enhanced Version that support https URLs:

=LEFT(RIGHT(A1,(LEN(A1)-if(isnumber(search("https", A1)), 8, 7))),(SEARCH("/",RIGHT(A1,(LEN(A1)-if(isnumber(search("https", A1)), 8, 7))))-1))

Posted by tomachi on May 12th, 2009 filed in Online Marketing, SEO