Home > Software design >  How to apply multiple criteria when using VLOOKUP QUERY IMPORTRANGE?
How to apply multiple criteria when using VLOOKUP QUERY IMPORTRANGE?

Time:04-28

So, right now, the formula below successfully queries data from another file, butthis based on a column's data as the criteria. The need is to have more than one criteria and I'm not sure if thecolumn to be compared against needs to come in as an additional query, together with the first query...so I'm lost here.

This is the formula I'm using:

=Arrayformula(
   if(F9:F="";"";
      vlookup(A9:A;
         QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/xxxxXXXXXXXxxxxxXXXX/edit";"Costura!A1:R"); 
         "select Col6, Col8, Col14";0)
      ;2;0)
    )
 )

Here's a enter image description here

CodePudding user response:

For a system like this, the best practice is just to import the entirety of the imported data in a tab of it's own, then run a vlookup to that tab using "both" criteria. This will simplify your formulas and also does not increase processing time at all. Just hide the "naked" import tab.

I will demonstrate on your sample sheet in two tabs beginning with "MK".

but the basic idea is an ampersanded (&'ed) [search key] in your VLOOKUP()

=ARRAYFORMULA(IFERROR(VLOOKUP(A6:A&B6:B,{MK_Data!A:A&MK_Data!H:H,MK_Data!J:J},2,0)))
  • Related