+ Reply to Thread
Results 1 to 3 of 3

Using a cell value in QUERY to access data from another worksheet.

  1. #1
    Registered User
    Join Date
    11-15-2020
    Location
    Pasadena, CA
    MS-Off Ver
    Office 365
    Posts
    4

    Using a cell value in QUERY to access data from another worksheet.

    I have 2 worksheets. The first (datasheet) contains a data spreadsheet which I access from sheet2.

    In sheet2 I wrote the following Query to get data from datasheet and move to sheet2. In this case, I'm selecting data based on which State I choose. In this case 'MA'. That works fine, but I want to make my Query more general by creating a dropbox in sheet2 from which I can select any State and have that cell value used in the Query. Let's say using the dropbox I choose the new State to be CA which is shown in cell D5 on sheet2. How do I change 'MA" in the Query to be the value in cell D5 in sheet2?

    =QUERY(datasheet!$A$2:$F$100, "SELECT B,A,C WHERE A = 'MA' , 0) (B,A & C refer to columns in datasheet, not in sheet2)

    A separate question: how do I alphabetically sort the selections in the dropbox?

    Thank you.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,858

    Re: Using a cell value in QUERY to access data from another worksheet.

    I believe that this is a google sheets issue. I am moving to other platforms.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,147

    Re: Using a cell value in QUERY to access data from another worksheet.

    Referring to a range is the same as in MS Excel ....

    Please Login or Register  to view this content.

+ 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] How to access data via VBA from a Connection Only Power Query query.
    By MLAN_75 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2020, 11:45 AM
  2. Excel Power Query Refresh or Access Query - 2nd Query Run is faster
    By Steveapa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2020, 10:16 AM
  3. Replies: 1
    Last Post: 05-08-2019, 01:28 PM
  4. Getting results of a SQL query on an Access database into a worksheet
    By AshleyY in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-27-2019, 04:53 PM
  5. [SOLVED] Access ADO - SQL query (3 cell values)
    By Dan17602 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-29-2012, 02:04 PM
  6. Database Query-a query that reads data from MS Access
    By Osmar Mateus in forum Excel General
    Replies: 4
    Last Post: 01-29-2006, 04:10 PM
  7. [SOLVED] How do I access worksheet cell data (i.e. cell sheet1!a4) from vi.
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2005, 12:14 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