2 different sql queries inside 1 excel worksheet...

Posted on 2012-09-11
Last Modified: 2012-09-13
Hi Experts,

I have an Excel workbook with several worksheets.. Each worksheet is using an SQL Query  with a Cell as a Filter.. (data is entered into a cell and presto the data is refreshed)

One of these worksheets needs to have an additional SQL Query added  2 rows after the 1st sql query data is displayed in worksheet.. this additional SQL Query will filter data on the cell that the first query has utilized..

Hopefully this makes sense
Question by:Mikeyman_01
    LVL 40

    Expert Comment

    by:Vadim Rapp
    > this additional SQL Query will filter data on the cell that the first query has utilized..

    Do you mean that the 2nd query is using a parameter, and that parameter comes from the cell filled by the 1st query?

    Author Comment

    LVL 40

    Expert Comment

    by:Vadim Rapp
    I actually just tried it in my excel 2003, and it worked as expected: when I change the value in A1, both cells below change.

    query 1
    query 2
    Isn't this what you see? Do you have "refresh automatically" in both?

    Author Comment

    Yes I have exactly what your are doing.. The problem is getting the 2 seperate sql queries that are written in microsoft query to show...I can only create 1 sql query per worksheet
    LVL 40

    Accepted Solution

    > I can only create 1 sql query per worksheet

    why only one?

    Here's the sample we created for you:

    the worksheet has two queries from Access database; to make it work, open each query in Microsoft Query, switch to SQL view, and adjust the path of the mdb file.

    Once you change the value in A1, both will change.

    Author Comment

    Perfect response.. Thank you

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Sum Per Month 7 23
    query question 4 19
    Check version 13 43
    exporting issues in Access 2 10
    Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
    The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now