+ Reply to Thread
Results 1 to 14 of 14

Multiple Web Queries

  1. #1
    Registered User
    Join Date
    06-26-2015
    Location
    DENVER, CO
    MS-Off Ver
    EXCEL 2011 FOR MAC
    Posts
    13

    Multiple Web Queries

    I have a table of zip codes (column F) for which I need the associated crime rates populated (columns H and I):

    Screen Shot 2015-06-27 at 3.43.24 PM.png

    So far, I've created a web query in another worksheet that returns the crime rate for whatever zip code is entered (cell B1) as follows:

    Screen Shot 2015-06-27 at 3.45.53 PM.png

    What would be the most efficient way to populate the values of cells B5 and B6 from the above query into the appropriate columns within the zip code table for each different zip code?

  2. #2
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Multiple Web Queries

    I'm by far no expert. But could you set the Range in Column F (Zipcode), and then loop through that range getting the crime rates you need, and then use a Cell.Offset to place the returned values in columns H and I?

  3. #3
    Registered User
    Join Date
    06-26-2015
    Location
    DENVER, CO
    MS-Off Ver
    EXCEL 2011 FOR MAC
    Posts
    13

    Re: Multiple Web Queries

    Quote Originally Posted by ptmuldoon View Post
    I'm by far no expert. But could you set the Range in Column F (Zipcode), and then loop through that range getting the crime rates you need, and then use a Cell.Offset to place the returned values in columns H and I?
    Thanks for the response. How would I loop through the range? The web query uses the zip code in cell B1, and places that zip code at the end of a URL string that it queries. So, if I set the query to lookup a range instead of a single cell, it ends up trying to pull an invalid URL

  4. #4
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Multiple Web Queries

    Quote Originally Posted by Chipless View Post
    Thanks for the response. How would I loop through the range? The web query uses the zip code in cell B1, and places that zip code at the end of a URL string that it queries. So, if I set the query to lookup a range instead of a single cell, it ends up trying to pull an invalid URL
    This is pretty basic but may help explain. And probably better to set a Named Range of the ZipCode Column. But the below should help in understanding how to set a range for the zipcode column, loop through it, and append the zip code value to your url.

    Please Login or Register  to view this content.
    You can also probably get some better help in VBA forum, or maybe a Mod can shift this topic there. And any sample code or file would be helpful too.

  5. #5
    Registered User
    Join Date
    06-26-2015
    Location
    DENVER, CO
    MS-Off Ver
    EXCEL 2011 FOR MAC
    Posts
    13

    Re: Multiple Web Queries

    Quote Originally Posted by ptmuldoon View Post
    This is pretty basic but may help explain. And probably better to set a Named Range of the ZipCode Column. But the below should help in understanding how to set a range for the zipcode column, loop through it, and append the zip code value to your url.

    Please Login or Register  to view this content.
    You can also probably get some better help in VBA forum, or maybe a Mod can shift this topic there. And any sample code or file would be helpful too.
    Thank you so much. Please forgive my total ignorance when it comes to VBA/macros (I wasn't even sure if I needed a macro to pull off what I wanted to do), but what do I need to change in your code? I changed the URL, but what should I change the value= to?

  6. #6
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Multiple Web Queries

    Quote Originally Posted by Chipless View Post
    Thank you so much. Please forgive my total ignorance when it comes to VBA/macros (I wasn't even sure if I needed a macro to pull off what I wanted to do), but what do I need to change in your code? I changed the URL, but what should I change the value= to?
    Can you provide the file you are working with? We need to see the web query and the corresponding results being generated to be able to loop through it.

  7. #7
    Registered User
    Join Date
    06-26-2015
    Location
    DENVER, CO
    MS-Off Ver
    EXCEL 2011 FOR MAC
    Posts
    13

    Re: Multiple Web Queries

    Quote Originally Posted by ptmuldoon View Post
    Can you provide the file you are working with? We need to see the web query and the corresponding results being generated to be able to loop through it.
    My apologies, I should have provided these from the start. Thank you so much for your help.

    Here is the query I created:Screen Shot 2015-06-28 at 5.17.42 PM.png


    And here is the result when a zip code is entered in (note, I only need the data in cells B5 and B6):
    Screen Shot 2015-06-28 at 5.18.11 PM.png
    Last edited by Chipless; 07-13-2015 at 09:05 PM.

  8. #8
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Multiple Web Queries

    Ok,

    What your asking is going to be beyond my limited skills. I've just begun learning how to pull data from the web. And I'm not sure if what your asking is going to be possible from that specific website as I do not see an html elementID for those values to reference and pull from.

    Someone else may have another suggestion or approach. Or possible the same data may be accessible from another website that has a free API, etc to reference and get pull the info.

    Essentially, you want to loop that web query. But it also appears that you can't just add the zipcode to the URL, and also need to know the state and town.

    But don't give up hope yet. This may still be workable. Just needs some sharper minds on it.

    I just noticed your using a Mac as well. And I think Excel behaves a little differently on a Mac as well vs a PC. So we may need some specific help in that direction as well.
    Last edited by ptmuldoon; 06-28-2015 at 08:57 PM.

  9. #9
    Registered User
    Join Date
    06-26-2015
    Location
    DENVER, CO
    MS-Off Ver
    EXCEL 2011 FOR MAC
    Posts
    13

    Re: Multiple Web Queries

    Quote Originally Posted by ptmuldoon View Post
    Ok,

    What your asking is going to be beyond my limited skills. I've just begun learning how to pull data from the web. And I'm not sure if what your asking is going to be possible from that specific website as I do not see an html elementID for those values to reference and pull from.

    Someone else may have another suggestion or approach. Or possible the same data may be accessible from another website that has a free API, etc to reference and get pull the info.

    Essentially, you want to loop that web query. But it also appears that you can't just add the zipcode to the URL, and also need to know the state and town.

    But don't give up hope yet. This may still be workable. Just needs some sharper minds on it.

    I just noticed your using a Mac as well. And I think Excel behaves a little differently on a Mac as well vs a PC. So we may need some specific help in that direction as well.
    Thank you for the quick response yet again. The URL still returns the data as desired if ONLY the zip code is changed at the very end of the URL (the state and city can remain constant, so I arbitrarily selected Denver, CO since it doesn't affect the results of the query). Does that make things easier?

  10. #10
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Multiple Web Queries

    It may help, but others may know better.

    So the city/state in the URL actually doesn't matter. It could be for any location, and web query result seems to only look at the Zip code and get the results for that location.
    Last edited by ptmuldoon; 06-29-2015 at 02:34 PM.

  11. #11
    Registered User
    Join Date
    06-26-2015
    Location
    DENVER, CO
    MS-Off Ver
    EXCEL 2011 FOR MAC
    Posts
    13

    Re: Multiple Web Queries

    Quote Originally Posted by ptmuldoon View Post
    So the city/state in the URL actually doesn't matter. It could be for any location, and web query result seems to only look at the Zip code and get the results for that location.
    That is correct.

  12. #12
    Registered User
    Join Date
    06-26-2015
    Location
    DENVER, CO
    MS-Off Ver
    EXCEL 2011 FOR MAC
    Posts
    13

    Re: Multiple Web Queries

    This is still unsolved, so if anyone has the time to respond, I'd pay you in eternal appreciation.

  13. #13
    Registered User
    Join Date
    06-26-2015
    Location
    DENVER, CO
    MS-Off Ver
    EXCEL 2011 FOR MAC
    Posts
    13

    Re: Multiple Web Queries

    Still need help.

  14. #14
    Registered User
    Join Date
    06-26-2015
    Location
    DENVER, CO
    MS-Off Ver
    EXCEL 2011 FOR MAC
    Posts
    13

    Re: Multiple Web Queries

    This still remains unsolved, so please help if you can!

    Edit: Just noticed that the query code screenshot link from post #7 is broken:
    Query Code.png
    Last edited by Chipless; 07-13-2015 at 09:06 PM.

+ 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. Replies: 0
    Last Post: 01-21-2013, 12:47 PM
  2. Embedded Access queries in Excel - if the database moves, how to update queries?
    By Paul_mcc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-06-2012, 07:52 PM
  3. Multiple Web Queries
    By eros18 in forum Excel General
    Replies: 2
    Last Post: 12-01-2011, 01:59 PM
  4. Multiple web queries
    By skazis in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-29-2011, 07:11 AM
  5. Multiple MIN queries
    By SAsplin in forum Excel General
    Replies: 1
    Last Post: 05-09-2011, 05:19 AM

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