+ Reply to Thread
Results 1 to 14 of 14

Extract Domain from URL

  1. #1
    Registered User
    Join Date
    12-16-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    7

    Extract Domain from URL

    guys, any idea how to extract domain from url?

    example:

    http://www.excelforum.com/newthread....=newthread&f=7
    = excelforum.com

    http://b.static.ak.fbcdn.net/rsrc.ph...rpZ7CHyvX7.gif
    = fbcdn.net

    http://03602334700.127.channel.faceb...p_1313978969=0
    = facebook.com

    cheers;
    Jerry

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Extract Domain from URL

    Please Login or Register  to view this content.



  3. #3
    Registered User
    Join Date
    12-16-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Extract Domain from URL

    hi snb, sorry don't quite understand what you mean? Am i suppose to use a "split" function within excel?

    cheers,
    Jerry

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Extract Domain from URL

    assuming you want the results outlined in your OP (ie remove string prior to period preceding domain qualifier)

    Please Login or Register  to view this content.
    above is VBA - if you want formula equivalent let us know.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Extract Domain from URL

    formula wise - with string in A1

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-16-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Extract Domain from URL

    Thks DonkeyOte it's great! but i've some that has the second level domain names.
    example: http://www.yahoo.com.uk/xxxxxxx
    the result return will be ".com.uk"


  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Extract Domain from URL

    In which case, assuming you can't use the entire string (per snb's original - eg b.static.ak.fbcdn.net rather than fbcdn.net) then things become more complicated.

    The complexity stems from the fact that there is little discernible logic in establishing which parts of the full domain are relevant and which are not... you will I think require a list detailing all possible domain qualifiers (eg .com, .com.uk etc...)

    If you want to pursue that post back with the list, some relevant examples and expected results.

  8. #8
    Registered User
    Join Date
    12-16-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Extract Domain from URL

    i've attached an excel with the URL and expected results.
    what i really want to achieve is ultimately to create an Internet Usage Statistics Report.

    http://www.jaxwithme.com/excel/sampl...rnet_usage.xls

    cheers;
    Jerry

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Extract Domain from URL

    Jerry, could you please upload your file here directly ?
    (to attach a file click the Paperclip icon within the Reply Window - if not visible first click Go Advanced and proceed from there)

  10. #10
    Registered User
    Join Date
    12-16-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Extract Domain from URL

    haha ok found it....

    sample_internet_usage.xls

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Extract Domain from URL

    Per my earlier note - given the lack of consistency I think you will need to detail all various qualifiers that may exist.

    I've put together a rough example using a formula based approach as I get the impression that's your preference.
    (the calculation is split based on assumption of XL version prior to XL2007)

    Note: it's important that the .domain.domain type qualifiers are listed below the .domain qualifiers (see Col E)

    On a final final note - please be aware that your Location is an important factor when it comes to people helping you as there exist significant locale differences in Excel (delimiters, date handling etc)
    For your own benefit I would suggest you modify the specified Location in your profile accordingly.

    edit: should add that the ordering of the all the qualifiers is important and we assume that where they double up they do so in pre-determined format (ie .com.net rather than .net.com)
    a UDF would be pref. in my opinion.
    Attached Files Attached Files
    Last edited by DonkeyOte; 12-17-2010 at 05:06 AM.

  12. #12
    Registered User
    Join Date
    12-16-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Extract Domain from URL

    you are cool !!!
    by the way yes, the ordering of all the qualifiers is important. won't a UDF be harder to come out with?

  13. #13
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Extract Domain from URL

    I am sure with more thought this could be streamlined, however, as a basic example - utilising the same named range listing as before (re: qualifiers)

    Please Login or Register  to view this content.
    called from a cell along the lines of:

    Please Login or Register  to view this content.
    at this point the ordering of the qualifiers becomes irrelevant - ie the above should prove more robust than the formula equivalent
    (eg possibility of .net.com and .com.net is not an issue)

  14. #14
    Registered User
    Join Date
    12-16-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Extract Domain from URL

    A million thks DonkeyOte....
    it solve my problem....

    cheers;
    Jerry

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1