Search code examples
sqlif-statementgoogle-sheetssearchgoogle-query-language

Google Sheets - Is it possible to use query to search for the data from the sheets that i select with dropdown list? If not, what can i do?


GoodDay everyone, recently I am trying to learn about using the Google Sheets. My question is same as the title, and these are some examples of the data.

The data from first sheet

The data from second sheet

I am trying to create a searching function in the main page in order to get some data by selecting a specific sheet.

And these are the result I expect to see. By choosing option using the dropdown list, I expect the query or any other things will detect the option and display all the data I need from the sheet I have chosen.

RESULT EXPECTED 1

RESULT EXPECTED 2

RESULT EXPECTED 3

Is that even possible in Google Sheets?


Solution

  • use:

    =INDEX(QUERY({
     IFERROR(JACKIE!A4:A/0, "JACKIE"), JACKIE!A4:B;
     IFERROR(KELVIN!A4:A/0, "KELVIN"), KELVIN!A4:B}, 
     "where Col2 is not null 
        and Col1 = '"&B2&"' 
        and Col3 = '"&B3&"'", ))