Question: In an excel sheet, I have from A1 to A6:

1, 2, 4, 6, 8, 9

I would like, using MATCH function, to retrieve the smallest interval that contains 5. Here, 4 and 6.

I can easily use the MATCH and INDEX function to find 4, but I can't find a way to find the 6. 

How can I reverse the order of the Array in the MATCH function?

Answer: 
You could also try these two formulas:

```
=LOOKUP(1,0/FREQUENCY(-B1,-A1:A6),+A1:A6)
=LOOKUP(1,0/FREQUENCY(B1,A1:A6),+A1:A6)

```

Notes:

* the list `A1:A6` does not need to be sorted
* if `B1` is equal to one of the values in `A1:A6` then both formulas return `B1`.
* if `B1` lies outside the range of values in `A1:A6`then one of the formulas returns `#N/A`
Use XMATCH, as explained on this site:

<https://exceljet.net/formula/xmatch-reverse-search>

XMATCH allows you to set the search direction, as follows:

```
=XMATCH(B1,A1:A6,0,-1)

```

Where `B1` is the cell to match, `A1:A6` is the array you are searching through, `0` indicates "exact match", and `-1` selects searching in the reverse direction (starting with cell A6 and ending with A1).