Find the closest value and lookup different field

I have a table like this:
| level | exp |

I want a formula that outputs the right level when an exp number that is within a range is given. For example:
With an input of 700, the formula should display 2 because the closest available exp value (rounded down) to 700 is 500 and the corresponding level is 2.
With an input of 10,000, the formula should display 5 because the closest available exp value (rounded down) is 7,875 which corresponds to level 5.
With an input of 33,886, it should output 8.

The solution in sheets would be something like (with E2 being the input):
=QUERY(B:A,"select A where B >= "&E2&" order by B limit 1",0)

How is it possible to do this in Airtable? Thanks!

Did you ever find anything out about how to do this? Needing something similar myself…