Search code examples
excelexcel-formulaexcel-2010excel-2007

Please explain why I get NA error for this: =MATCH(2,{1.2;1.9;2.6;3.8;5.5},-1)


Please note that I am getting the correct result of 2 for the formula =MATCH(2,{1.2;1.9;2.6;3.8;5.5},1) because the match type is 1 which finds the largest value (1.9) that is smaller than Lookup value. But when I try =MATCH(2,{1.2;1.9;2.6;3.8;5.5},-1) which must find the smallest value (2.6) that is greater than the Lookup value I get NA error. The answer is supposed to be 3 because 2.6 is the value after 2 that is smallest. Please explain.


Solution

  • The match type has to be used in combination with the right sorting of the array.

    Matchttype 1 --> sort ascending

    Matchttype -1 --> sort descending