We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide

Excel help please

_Andy_
_Andy_ Posts: 11,150 Forumite
Hi guys

Hoping you can help - I know this is probably quite simple, maybe using LEFT and FIND?

Anyway, I have a huge list of websites. Mixture of domains so some are .com, some .de, etc etc.
All end with a trailing slash /

so eg

http://www.bbc.co.uk/
http://www.moneysavingexpert.com/

etc

What I'd like to do is have another column which extracts the type of domain (eg com, co.uk, nl, de) etc. So I can then filter the list by domain type.

But can't work out how to do it, especially as it's complicated by stuff like .co.uk.

I guess it needs to be something like it looks for text after the second '.' then loses the final / ?

Thanks in advance :)

Comments

  • phona
    phona Posts: 249 Forumite
    Part of the Furniture 100 Posts
    edited 2 May 2013 at 10:34AM
    Been playing with that problem for a while and found this works:
    =IF(ISNUMBER(FIND("co.uk",A1)),"UK","Non-UK")

    to determine if it's .co.uk or something else.
    To find other extensions you could use
    =IF(ISNUMBER(FIND("co.uk",A1)),"UK",IF(ISNUMBER(FIND(".com",A1)),"USA","Other"))

    So you can nest the statement inside itself by replacing "Other" with another copy of IF(ISNUMBER... etc
    This will get messy quickly if you have lots of different extensions but should work (by my tests anyway!) There may be a better way...

    Edit: by the way this can pick up wrong results if the URL happens to contain the extensions after the www. I tried
    https://www.comparemyinsurance.co.uk - correctly detected as UK
    https://www.completenonsense.eu - incorrectly detected as US
    Maybe if .eu was in my IF-function it would have worked though?

    Edit2: Please don't click those links... I have no idea if they go anywhere...
  • rmg1
    rmg1 Posts: 3,159 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    Use this formula, it assumes rthe webpage address is in column A:-
    =MID(A1,FIND(".",A1,FIND(".",A1,1)+1),LEN(A1)-B1)

    I've tested it on .com and .co.uk addresses but that's about it.
    :wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:

    Any posts are my opinion and only that. Please read at your own risk.
  • _Andy_
    _Andy_ Posts: 11,150 Forumite
    thanks RMG - I get 'value' error tho (changed to A2 in my sheet) - also wasn't sure why the B1 ref?

    thanks
  • rmg1
    rmg1 Posts: 3,159 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    Ooops! I was testing my formula in bits and forgot to change everything to make it one formula. Try this:-
    =MID(A1,FIND(".",A1,FIND(".",A1,1)+1),LEN(A1)-FIND(".",A1,FIND(".",A1,1)+1))
    :wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:

    Any posts are my opinion and only that. Please read at your own risk.
  • bod1467
    bod1467 Posts: 15,214 Forumite
    www.bbc.co.uk/	.co.uk
    www.bbc.com/	.com
    www.bbc.de/	.de
    www.bbc.fr/	.fr
    www.bbc.eu/	.eu
    
    Tests and results using RMG's formula. :)
  • _Andy_
    _Andy_ Posts: 11,150 Forumite
    awesome but it's chopping last digit off end for me for some reason, e.g. I get .co rather than .com

    thanks again :))
  • JimmyTheWig
    JimmyTheWig Posts: 12,199 Forumite
    Part of the Furniture 10,000 Posts Name Dropper Combo Breaker
    _Andy_ wrote: »
    awesome but it's chopping last digit off end for me for some reason, e.g. I get .co rather than .com
    I would guess that you don't have a trailing slash on all of them?

    Try this:
    =SUBSTITUTE(MID(A1,FIND(".",A1,FIND(".",A1,1)+1),LEN(A1)-FIND(".",A1,FIND(".",A1,1))),"/","")

    [Formula could be tidied up, but should work as it is.]
  • _Andy_
    _Andy_ Posts: 11,150 Forumite
    Ah dammit, forgot to say - have removed all trailing slashes
  • _Andy_
    _Andy_ Posts: 11,150 Forumite
    Sorted, thank you so much guys, really appreciate it :)
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 353.5K Banking & Borrowing
  • 254.2K Reduce Debt & Boost Income
  • 455K Spending & Discounts
  • 246.6K Work, Benefits & Business
  • 602.9K Mortgages, Homes & Bills
  • 178.1K Life & Family
  • 260.6K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16K Discuss & Feedback
  • 37.7K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.