Litres/Milage | 1.2 | 1.5 | 1.501 |
---|---|---|---|
1500 | 41.8 | 43.4 | 51.8 |
5500 | 72.64 | 79.18 | 90.63 |
25000 | 31.78 | 31.79 | 39.22 |
25001 | 20.56 | 23.85 | 25.87 |
on the table above I want to create formular to use data from that table where I have litre(x axis) and miles y (axis).
I have two cells(litres and Milage) where there is value entered and when those values are entered it will return the answer from the table For EG if i have 1.4 litres and 5600 miles it should return a value of 79.18 if the same milage was done with litre 0f 1.6 it would return a value of 90.63
I have tried doing index with matches but that doesn't take into account value amounts between rows or column headers
I tried using if statements. I'm lost for next stages Index(,Match,match) was the formular i tried before The table is on sperate sheet to the two values being used
Just for variety, if what OP wants is the nearest match, you could try comparing to the average of each adjacent pair of lookup values (mileage or litres):
=LET(litres,B$1:D$1,
mileage,A$2:A$5,
values,B$2:D$5,
lmap,(litres+HSTACK(DROP(litres,,1),9^9))/2,
mmap,(mileage+VSTACK(DROP(mileage,1),9^9))/2,
XLOOKUP(F2,lmap,XLOOKUP(G2,mmap,values,,1),,1))
My formula for 'up to and including' each limit would be
=LET(litres,B$1:D$1,
mileage,A$2:A$5,
values,B$2:D$5,
lmap,HSTACK(DROP(litres,,-1),9^9),
mmap,VSTACK(DROP(mileage,-1),9^9),
XLOOKUP(J3,lmap,XLOOKUP(K3,mmap,values,,1),,1))
As shown by @Scott Craner you can vary the limits slightly to make it inclusive or non-inclusive, or alternatively to make it match up to but not including the limits:
=LET(litres,B$1:D$1,
mileage,A$2:A$5,
values,B$2:D$5,
lmap,HSTACK(0,DROP(litres,,-1)),
mmap,VSTACK(0,DROP(mileage,-1)),
XLOOKUP(J3,lmap,XLOOKUP(K3,mmap,values,,-1),,-1))