I have inputs in my data like below and i need to calculate a value using the below values in R
E7 = 20000
EXCEL VIEW(data)
L M N O
6 Min_Benefs Max_Benefs MSR_Min MSR_Max
7 5000 5999 0.039 0.036
8 6000 6999 0.036 0.034
9 7000 7999 0.034 0.032
10 8000 8999 0.032 0.031
11 9000 9999 0.031 0.03
12 10000 14999 0.03 0.027
13 15000 19999 0.027 0.025
14 20000 49999 0.025 0.022
15 50000 59999 0.022 0.02
16 60000 0.02 0.02
from the above data and inputs i need to find out the value of MSR using below formula in R
MSR = ( VLOOKUP($E$7,$L$7:$O$16,3)*(VLOOKUP($E$7,$L$7:$O$16,2) - $E$7) + VLOOKUP($E$7,$L$7:$O$16,4)*($E$7 - VLOOKUP($E$7,$L$7:$O$16,1)))/(VLOOKUP($E$7,$L$7:$O$16,2) - VLOOKUP($E$7,$L$7:$O$16,1))
I got MSR = 0.025 when my E7 = 20000
I tried doing it in R using different functions mentioned in the below link
How to do vlookup and fill down (like in Excel) in R?
But i failed all the time, it would be great if some one explains the solution for this.