+ Reply to Thread
Results 1 to 24 of 24

Automatically Extracting the Domain Names from a list of Websites in Excel 2007

  1. #1
    Registered User
    Join Date
    09-27-2012
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    15

    Question Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    I am trying to create a function in Excel that can take various different listings of websites in a column and place just the primary domain into another column as the first column is filled with web addresses.

    Like taking these (currently in column C starting in row 4):
    http://www.abc.com/reader
    https://farm.cow.org
    splat.net
    www.cat.co.uk/meow
    http://xyz.com


    And outputting to the corresponding rows in column J with:
    www.abc.com
    farm.cow.org
    splat.net
    www.cat.co.uk
    xyz.com


    Related Thread: http://www.excelforum.com/excel-form...-from-url.html

    (I'm a noob at Excel, but I'm learning pretty fast.) I am currently using Excel 2007 with various macros in the workbook already. Any code suggestions would be greatly appreciated. I've been working on this trying to learn for acouple of days now to no avail.

  2. #2
    Registered User
    Join Date
    09-27-2012
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    Would a series of "If"..."Then" statements work with trying some search method for "//" and "/" be the best options?
    Any code suggestions or video tutorial suggestions would be most welcome. I've been searching now for over a week, but I'm likely not searching for the right terms.

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    You could eventually start with the idea of using
    Ctrl+H
    replace what *//
    with (lave blank)
    Replace all

    And then the same for /*

  4. #4
    Registered User
    Join Date
    09-27-2012
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    Thanks for the input Pepe.
    But I would prefer to do this by automation or script since I will likely be looking at hundreds, if not thousands, of websites.

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    Why not record a macro if you want. Ctrl+H is not on a cell per cell basis but can be applied to an entire workbook

  6. #6
    Registered User
    Join Date
    09-27-2012
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    So, how would the macro work then? I would need some function to handle all the different varitions of addresses like I noted earlier. They are all different in their formating:
    http://www.abc.com/reader
    https://farm.cow.org
    splat.net
    www.cat.co.uk/meow
    http://xyz.com

    That's the hard part that I was hoping someone had a good solution for.

  7. #7
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    Assuming all in a column starting at A1

    Please Login or Register  to view this content.
    Last edited by Kyle123; 10-15-2012 at 06:25 AM. Reason: Simplicifation

  8. #8
    Registered User
    Join Date
    09-27-2012
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    15

    Question Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    Thanks Kyle123.
    So, should I use the output column as as function and change the subs to functions while using...
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    ...in the cell I want output to?

    I'm not sure how to try this with what I have thus far.

  9. #9
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    No, you said you wanted it done through automation, not through a function.

    Put your urls in column A of sheet1

    Put the code in a new module, then run it.

  10. #10
    Registered User
    Join Date
    09-27-2012
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    OK, I see now, but there are three problems.

    1. Some of the URL's (ex http://www.abc.com/reader.html) are making two lines like
    * abc.com
    * reader.html

    2. Is there a way to make the columns coordinate to rows? Right now my list starts down a few rows, but the list of extracted URL's start at the top...

    3. The cells that are blank, but have formatting (a border) are returning a value of "#N/A" ...it there a good way to tell it to be blank, or not fill anything in?

    Thanks! This looks like this is well on its way to making this happen.
    Last edited by retardlike69; 10-15-2012 at 10:12 AM. Reason: Clarified Posting

  11. #11
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    This is why it is always better to upload a sample workbook with all the permutations of how your urls can exist and where to start from.

    What row row your urls start on?

    This will sort out the .html, but you need to tell us of any other extensions you have
    Please Login or Register  to view this content.
    Last edited by Kyle123; 10-15-2012 at 10:42 AM.

  12. #12
    Registered User
    Join Date
    10-05-2012
    Location
    Sint-Niklaas, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    I tried to apply the same code for my file but got line starting with .offset highlighted with fault 13 notification.
    Any idea's why it is the case ?

  13. #13
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    What's the error say? You really need to upload a workbook

    Edit oops, you're not the op. The data has to be in sheet 2 and start in A3
    Last edited by Kyle123; 10-16-2012 at 10:32 AM.

  14. #14
    Registered User
    Join Date
    10-05-2012
    Location
    Sint-Niklaas, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    I'm using a dutch version of excel so I don' have the English description of the fault. However, I think "Types do not match" should say something to you. Right?
    I tried to apply the code for column X "URL aanbod" in my file "URL AANBOD". Please don't go mad. It's Dutch

    Thanks in advance for your help.

    Andrei
    Attached Files Attached Files

  15. #15
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    It won't work for a few reasons, firstly you need to use column x, secondly some of the cells have missing values and thirdly you have more than one url per cell.

    The best thing to do is start your own thread, explain what you want to do and upload your workbook

  16. #16
    Registered User
    Join Date
    10-05-2012
    Location
    Sint-Niklaas, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    I appreciate your suggestion.
    Last edited by Cutter; 10-17-2012 at 05:46 PM. Reason: Removed whole post quote

  17. #17
    Registered User
    Join Date
    09-27-2012
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    Thanks again Kyle123...
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I suppose adding ".htm", ".shtml", ".php", ".jsp", ".js", ".cgi", ".asp", and ".aspx" extensions would pretty much cover everything.

    But the bigger problem would be getting the rows to output on the same row as the URL put into the function.
    For example, there are some gaps in the column and the output is ignoring the correlation between rows and output.

    My input column starts at D4, there is data is cell D6, D9, D14, D15...and so forth.
    The function is placing (accurate but misplaced) data starting at K4 (offset of 7 in my function), the outputs the D6 input to K5, D9 input to K6, and so forth. After it reaches the end of the list, it places "#N/A" into each column thereafter.
    (I think the #N/A output is caused by the function expecting a data input due to the use of borders and cell coloration...) Maybe there is a way to output "" if there is is not data input?
    Last edited by retardlike69; 10-17-2012 at 07:07 AM. Reason: added other extensions

  18. #18
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    Ok, it's time to upload a workbook

  19. #19
    Registered User
    Join Date
    09-27-2012
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    15

    Post Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    Here's a barebones copy of the database I'm building...

    EDIT: I added in some generic URL's for you.
    P.S. Right now the "code" is in a button...that was being used for testing purposes. Of course, I wanted to make it automatic after filling in the cell asking for the website URL.
    Attached Files Attached Files
    Last edited by retardlike69; 10-17-2012 at 06:59 AM. Reason: Added some example URL's

  20. #20
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    There aren't any urls...

  21. #21
    Registered User
    Join Date
    09-27-2012
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    Uploaded a fixed copy. (Sorry about that.) Try again please.

  22. #22
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    Try this:
    Please Login or Register  to view this content.
    Then:
    PHP Code: 
    =CleanString(D2
    Copied down etc

  23. #23
    Registered User
    Join Date
    09-27-2012
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    Wonderful! That is exactly what I needed!!!
    +REP

    Thanks for all your hard work and help in getting a clean working solution!

    To other Users here...be sure to note the correct code to access to function is:
    Please Login or Register  to view this content.

  24. #24
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Automatically Extracting the Domain Names from a list of Websites in Excel 2007

    @ retardlike69

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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