Search code examples
google-sheets-formulawildcardcriteria

Google Sheets vlookup based on multiple criteria with wildcards


I'm trying to extend a gs vlookup formula with a 2nd criteria.

This formula works fine with 1 criteria in column A. =ArrayFormula(IFNA(VLOOKUP(""&A2:A&"",sheet2!C:D,2,FALSE), ""))

But I would like to extend the formula with a 2nd (OR) criteria . That sould somehow look like this: =ArrayFormula(IFNA(VLOOKUP(""&A2:A&"" OR ""&B2:B&"",sheet2!C:D,2,FALSE), "")) (The fomula shoud check if one of the 2 criterias (in column A or B) matches with column C on sheet2 and return the value from D on sheet2)

Is this even possible with a fomula?


Solution

  • This formula seems to do what you're looking for, placed in C2:

    =ArrayFormula(
      IFNA(  VLOOKUP(A2:A,Sheet2!C:D,2,0),
        IFNA(VLOOKUP(B2:B,Sheet2!C:D,2,0),"no match")))
    

    I think there are several other ways of doing this, but I went with what you'd started with.

    I haven't added error checking yet, for blank rows, etc., to keep it straightforward.

    enter image description here