Assuming that cell B2 has a hostname like foo.bar.baz.example.com the following will extract just the domain name form the hostname, e.g. "example.com"
Of course this doesn't work if you really care about supporting all the TLDs in the world but seriously, why was that so hard Excel?
The same thing (with the same TLD issue), in Python (hat tip to StackOverflow):
url = 'http://foo.bar.baz.example.com'
Go read the entire StackOverflow post to understand how to deal with TLDs but in case you're not always so lucky to have Python and have to use Excel, there you go. If anyone has any better ways to extract the domain in excel, please let me know.