How to interpolate between values in a lookup table in Excel
Formula (Excel and Google Sheets)
=LET(i,MATCH(E1,A2:A8,1),dLo,INDEX(A2:A8,i),dHi,INDEX(A2:A8,i+1),vLo,INDEX(B2:B8,i),vHi,INDEX(B2:B8,i+1),vLo+(E1-dLo)*(vHi-vLo)/(dHi-dLo))Find the row below the value with MATCH, then take the straight line to the next row: =LET(i,MATCH(E1,A2:A8,1),dLo,INDEX(A2:A8,i),dHi,INDEX(A2:A8,i+1),vLo,INDEX(B2:B8,i),vHi,INDEX(B2:B8,i+1),vLo+(E1-dLo)*(vHi-vLo)/(dHi-dLo)).
- Result on the example
- 262.3 in
E2 - Works in
- Excel 2021, 2024 and Microsoft 365
- Google Sheets
- Same formula
See it work
The formula is already in E2. Change any input and the result updates, or edit the formula to experiment.
How it works
MATCH with 1 returns the last depth at or below 27 inches, the 20-inch row. The value lies 7/10 of the way to the 30-inch row, so the volume is 172 + 7 × (301 − 172) / 10 = 262.3 gallons. LET names the two points so the straight-line formula reads like the math.
=LET(i,MATCH(E1,A2:A8,1),dLo,INDEX(A2:A8,i),dHi,INDEX(A2:A8,i+1),vLo,INDEX(B2:B8,i),vHi,INDEX(B2:B8,i+1),vLo+(E1-dLo)*(vHi-vLo)/(dHi-dLo))Result262.3
i3A name defined in LET, or a named range.
E127The value in E1.
A2:A87 rows × 1 col: 0, 10, 20, 30, …A range: 7 cells in one column.
MATCH(E1,A2:A8,1)3MATCH: Position of a value in a list. 0 = exact match.- lookup_value
E127 - lookup_array
A2:A87 rows × 1 col: 0, 10, 20, 30, … - match_type
1
- lookup_value
dLo20A name defined in LET, or a named range.
INDEX(A2:A8,i)20INDEX: Value at a given row and column of a range.- array
A2:A87 rows × 1 col: 0, 10, 20, 30, … - row_num
i3
- array
dHi30A name defined in LET, or a named range.
i+14The + operator adds.
INDEX(A2:A8,i+1)30INDEX: Value at a given row and column of a range.- array
A2:A87 rows × 1 col: 0, 10, 20, 30, … - row_num
i+14
- array
vLo172A name defined in LET, or a named range.
B2:B87 rows × 1 col: 0, 64, 172, 301, …A range: 7 cells in one column.
INDEX(B2:B8,i)172INDEX: Value at a given row and column of a range.- array
B2:B87 rows × 1 col: 0, 64, 172, 301, … - row_num
i3
- array
vHi301A name defined in LET, or a named range.
i+14The + operator adds.
INDEX(B2:B8,i+1)301INDEX: Value at a given row and column of a range.- array
B2:B87 rows × 1 col: 0, 64, 172, 301, … - row_num
i+14
- array
E1-dLo7The - operator subtracts.
vHi-vLo129The - operator subtracts.
E1-dLo)*(vHi-vLo903The * operator multiplies.
dHi-dLo10The - operator subtracts.
E1-dLo)*(vHi-vLo)/(dHi-dLo90.3The / operator divides.
vLo+(E1-dLo)*(vHi-vLo)/(dHi-dLo262.3The + operator adds.
LET(i,MATCH(E1,A2:A8,1),dLo,INDEX(A2:A8,i),dHi,INDEX(A2:A8,i+1),vLo,INDEX(B2:B8,i),vHi,INDEX(B2:B8,i+1),vLo+(E1-dLo)*(vHi-vLo)/(dHi-dLo))262.3LET: Names values inside a formula.- name1
i3 - value1
MATCH(E1,A2:A8,1)3 - name2, value2
dLo20 - calculation
INDEX(A2:A8,i)20 - name2
dHi30 - value2
INDEX(A2:A8,i+1)30 - name3
vLo172 - value3
INDEX(B2:B8,i)172 - name4
vHi301 - value4
INDEX(B2:B8,i+1)301 - name5
vLo+(E1-dLo)*(vHi-vLo)/(dHi-dLo262.3
- name1
In Google Sheets
The same formula works in Google Sheets: =LET(i,MATCH(E1,A2:A8,1),dLo,INDEX(A2:A8,i),dHi,INDEX(A2:A8,i+1),vLo,INDEX(B2:B8,i),vHi,INDEX(B2:B8,i+1),vLo+(E1-dLo)*(vHi-vLo)/(dHi-dLo)). We ran it in Google Sheets mode on the same data and it returns 262.3.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =INDEX(B2:B8,MATCH(E1,A2:A8,1))+(E1-INDEX(A2:A8,MATCH(E1,A2:A8,1)))*(INDEX(B2:B8,MATCH(E1,A2:A8,1)+1)-INDEX(B2:B8,MATCH(E1,A2:A8,1)))/(INDEX(A2:A8,MATCH(E1,A2:A8,1)+1)-INDEX(A2:A8,MATCH(E1,A2:A8,1))) | 262.3 | The same calculation without LET, for Excel 2019 and earlier. |
Common mistakes
- The first column must be sorted from smallest to largest for MATCH with 1.
- A value equal to the last row (60) has no next row, so
i+1returns #REF!. Handle it withIF(E1>=MAX(A2:A8),INDEX(B2:B8,ROWS(B2:B8)),…). - A plain approximate lookup returns 172, the 20-inch value, which is off by 90 gallons here.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Interpolate between values in a lookup table
E2, estimate the volume for the depth in E1 by linear interpolation between the two nearest rows.Questions
Is there a built-in function?
FORECAST.LINEAR on the two surrounding points does the same: give it the x and y values of rows i and i+1.
How do I interpolate a whole column of depths?
Put the formula next to each depth with E1 replaced by the cell, and lock the table with $.
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.