Search code examples
google-sheetsimportgoogle-sheets-formulavlookupgoogle-query-language

Importrange Query


I am stuck, I have tried multiply codes but I must have some kind of error in it.

https://docs.google.com/spreadsheets/d/1MnqgFF9wtk_9u57BC3mPqxxzUo7wkY4Ode7G-a6t_P8/edit#gid=958689010

I want to create my own filter with ID's I have assigned to categories. When I put in that certain ID, it will show me all categories levels automatically.

I assumed it will work with:

=QUERY(IMPORTRANGE(eBayKategorie!A:G), "where Col1 matches '"&TEXTJOIN("|", 1, A:A)&"'", 0)

But I get an error message. am I missing a . or ,? Does someone know what I am missing?

I also tried to work with Vlookup and named ranges, also query only and named ranges but this only applies to one cell and seems overly complicated. It does work, but it looks like, it leaves a lot of room for mistakes (See tabs with VLOOKSUP in naming)

=VLOOKUP(C2, Katgegories,2,false)

All the best.


Solution

  • IMPORTRANGE is a formula to get data from another spreadsheet.

    do you need to import stuff from another spreadsheet?

    if yes, the correct syntax is:

    =QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1MnqgFF9wtk_9u57BC3mPqxxzUo7wkY4Ode7G-a6t_P8/edit#gid=958689010", "Register!A:G"), 
     "where Col1 matches '"&TEXTJOIN("|", 1, C2:C)&"'", 0)
    

    if you don't need to import stuff from a different spreadsheet but just a different sheet/tab use:

    =QUERY({Register!A:G}, 
     "where Col1 matches '"&TEXTJOIN("|", 1, C2:C)&"'", 0)
    

    in your case I believe you need:

    =INDEX(IFNA(VLOOKUP(C2:C, Register!A2:G, {2,3,4,5,6,7}, 0)))
    

    enter image description here