Search code examples
excelindexingmatchclause

Index Match Where Clause Applies


I want to return the value based on index/match where clause applies.

==> Find barcode number where Price = 10 (this is variable) AND Flavour = Passion.

So far it returns only the barcode of the first row with "10" that it finds i.e. Barcode 1 instead of 2.

=IF(ISERROR(INDEX(F:F,MATCH(B2,I:I,0))),"",INDEX(F:F,MATCH(B2,I:I,0)))

Sample

Result so far:

enter image description here

Can someone advise? Thanks!


Solution

  • Yes, it's possible using an array formula (Hit Ctrl+Enter instead of Enter). For example:

     =INDEX(F:F, MATCH("Passion"&10,G:G&I:I,0))
    

    "Passion" = 1st criteria, 10 = 2nd criteria
    (these can be substituted by a cell reference where the criteria are saved)
    G:G = 1st criteria range, I:I = 2nd criteria range

    On a sidenote, I would suggest the IFERROR() formula instead of IF(ISERROR()) to make it look neat and tidy.