Hi, i need help with creating a specific formula for a school project that entails extrapolating values from a constant data sheet.

For example, for a given number between 1 and 40 there are 40 different values. I need a formula that will be able to grab a value based on the number from 1 to 40 but that will also be able to find an average value if i have a given number that isn't a whole number (like 1.5, 2.5,3.5 etc).

Say my data table is

1 100.1
2 100.5
3 100.8
4 101,2
...
40 104.6

If my number is 1.5, i need the formula to calculate and take the average value between 100.1 and 100.5.