+ Reply to Thread
Results 1 to 11 of 11

VBA to extract search string from URL

  1. #1
    Registered User
    Join Date
    06-26-2014
    Location
    Queensland, Australia
    MS-Off Ver
    2016
    Posts
    35

    VBA to extract search string from URL

    Hi All

    I'm not sure if this can actually be done, however I will ask the question.

    I have a list of hundreds of search result URLs from Google, Yahoo and Bing.

    I need to extract only the search result keyword/s from the URL (please see attached example).

    Is this possible to do using VBA?

    Ultimately, I'd like to be able to modify the VBA to extract keywords from URLs from other search engines as well.

    I'd appreciate help and/or advice with achieving this.

    Many thanks
    darls15
    Attached Files Attached Files
    Last edited by darls15; 09-11-2020 at 02:24 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: VBA to extract search string from URL

    UDF
    B2:
    =GetKeyWords(A2)
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-26-2014
    Location
    Queensland, Australia
    MS-Off Ver
    2016
    Posts
    35

    Re: VBA to extract search string from URL

    Hi jindon

    Thanks so much for your quick reply.

    I've tried your code with my original list and it works well on the URLs that have a plus sign between the words, e.g. online+bike+builder.

    However, in my original list there are a lot of URLs where the search terms don't have a plus (+) sign between words, e.g.
    http://www.bing.com/search?q=how to calculate kj to calories&FORM=AWRE&adlt=strict
    http://www.google.com/search?q= what is a doberman pinscher &safe=active
    http://au.search.yahoo.com/search?p=people that don't eat meat&vm=r

    As well as URLs where the search terms appear at the end...
    http://google.com/search?q=what was mummification

    Is there a way to include a solution in the code for these as well?

    Thanks
    darls15

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: VBA to extract search string from URL

    Can you upload a workbook with all the possible variation of data and the results that you want?

    So that I can see if it is possible or not.

  5. #5
    Registered User
    Join Date
    06-26-2014
    Location
    Queensland, Australia
    MS-Off Ver
    2016
    Posts
    35

    Re: VBA to extract search string from URL

    Hi jindon

    Here you go - Example_URLKeywordExtract_2.xlsx.

    I've tried to capture all the variations of the URLs in the attached, including some that are the results from searches within sites. I'm not sure whether these ones will be possible however thought I'd include them as well.

    Your help with this is much appreciated. Thank you.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: VBA to extract search string from URL

    And you desired results?

  7. #7
    Registered User
    Join Date
    06-26-2014
    Location
    Queensland, Australia
    MS-Off Ver
    2016
    Posts
    35

    Re: VBA to extract search string from URL

    Apologies, I have updated the spreadsheet to include desired results

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: VBA to extract search string from URL

    I'm out now, I will reply in a couple of hours.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: VBA to extract search string from URL

    Try change to function to
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    06-26-2014
    Location
    Queensland, Australia
    MS-Off Ver
    2016
    Posts
    35

    Re: VBA to extract search string from URL

    @jindon, my apologies for taking so long in getting back to you on this. I've been away working in a different area and have just returned. This is beyond brilliant and I can't thank you enough. I've tested it and it works perfectly! Thank you thank you

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: VBA to extract search string from URL

    You are welcome and thanks for the rep.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA to search string in PDF and extract pages
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-26-2018, 08:28 AM
  2. [SOLVED] Formula to search a range for a string and then extract certain dta from string
    By gratedane8 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-08-2018, 06:09 PM
  3. [SOLVED] Search and Find - To extract some text from a string of text
    By Badvgood in forum Excel General
    Replies: 4
    Last Post: 11-01-2016, 01:04 PM
  4. [SOLVED] Search for string across header row, then search for another string down found column
    By TucsonJack in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2012, 02:09 PM
  5. Replies: 1
    Last Post: 04-23-2012, 10:27 AM
  6. Replies: 7
    Last Post: 03-29-2012, 01:25 PM
  7. search a string withing a string : find / search hangs
    By itarnak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-24-2005, 11:05 AM

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