Excel Interpolation Formula: Step-by-Step Guide
In this article
Excel has no built-in interpolation function, but you can interpolate any two known points with a single formula using linear interpolation. The formula is =y1+(x-x1)*(y2-y1)/(x2-x1), where (x1,y1) and (x2,y2) are your known points and x is the value you want to estimate. This works for estimating missing values in a table, filling gaps in sensor readings, or finding a value between two data points on a straight line.
What You'll Need
- Excel 2016 or later (or Excel for Microsoft 365) on Windows or Mac. The formulas below also work in Excel for the web, though the XLOOKUP function is only available in newer versions.
- At least two known data points arranged in two columns: one column of X values (sorted ascending) and one column of Y values.
- The X value you want to interpolate, entered in its own cell.
Note that menu labels and function availability can differ slightly by Excel version and region. If a function like XLOOKUP is missing, use the INDEX/MATCH alternative described in Step 4.
Step-by-Step
- Set up your data. Put your known X values in column A (A2:A10, for example) and the matching Y values in column B (B2:B10). Sort column A from smallest to largest. Enter the X value you want to interpolate in cell D2.
- Find the lower and upper X bounds. In cell E2, enter
=MATCH(D2,A2:A10,1). This returns the position of the largest X value that is less than or equal to D2. In cell F2, enter=E2+1to get the position of the next X value. If D2 falls outside your data range, MATCH returns an error or the last row, so check that D2 sits between the smallest and largest X values. - Pull the four known values. In G2 enter
=INDEX(A2:A10,E2)for x1, in H2 enter=INDEX(B2:B10,E2)for y1, in I2 enter=INDEX(A2:A10,F2)for x2, and in J2 enter=INDEX(B2:B10,F2)for y2. These four cells hold the points that bracket your target X. - Apply the interpolation formula. In cell K2 enter
=H2+(D2-G2)*(J2-H2)/(I2-G2). This is the linear interpolation result: it moves from y1 toward y2 in proportion to how far D2 sits between x1 and x2. Format K2 to the same number of decimals as your source data. - Combine into one formula (optional). If you prefer a single cell, replace the helper cells with this all-in-one version:
=INDEX(B2:B10,MATCH(D2,A2:A10,1))+(D2-INDEX(A2:A10,MATCH(D2,A2:A10,1)))*(INDEX(B2:B10,MATCH(D2,A2:A10,1)+1)-INDEX(B2:B10,MATCH(D2,A2:A10,1)))/(INDEX(A2:A10,MATCH(D2,A2:A10,1)+1)-INDEX(A2:A10,MATCH(D2,A2:A10,1))). It is long but avoids helper columns. - Use XLOOKUP for a cleaner version (Excel 365 and Excel 2021+). If your version supports XLOOKUP, enter
=LET(x,D2,xs,A2:A10,ys,B2:B10,i,XMATCH(x,xs,1),y1,INDEX(ys,i),y2,INDEX(ys,i+1),x1,INDEX(xs,i),x2,INDEX(xs,i+1),y1+(x-x1)*(y2-y1)/(x2-x1)). LET names the intermediate values so the formula stays readable. If LET or XLOOKUP is not available, stick with Step 4 or 5. - Copy down for multiple targets. Put several X values in D2:D20 and copy the formula down. Lock the data ranges with dollar signs (for example
$A$2:$A$10) so the references do not shift as you fill. - Check the result. Pick a target X that equals one of your known X values. The formula should return exactly the matching Y value. If it does not, your X column is probably unsorted or contains text instead of numbers.
Common Mistakes
- Unsorted X values. MATCH with match type 1 requires ascending order. If the X column is unsorted, you get the wrong bracket or an error.
- Text-formatted numbers. Numbers stored as text (often from CSV imports) break MATCH and INDEX. Convert them with Text to Columns or multiply by 1.
- Extrapolating by accident. If the target X is below the smallest or above the largest known X, the formula either errors or produces a meaningless extrapolated value. Guard with an IF check.
- Missing the +1. Forgetting to add 1 to the MATCH position returns the same point twice, giving a divide-by-zero error.
- Relative references when copying. Without dollar signs, the data ranges slide down and the formula reads the wrong rows.
Tips
- Linear interpolation assumes a straight line between points. For curved data, use more closely spaced points or a trendline-based approach instead.
- Wrap the formula in IFERROR to show a blank or a custom message when the target is out of range.
- Name your ranges (Formulas > Define Name) so the formula reads like
=y1+(x-x1)*(y2-y1)/(x2-x1)with real names. - Keep a separate column for the interpolated result so you can compare it with measured values later.
- For chart-based interpolation, add a scatter chart with a linear trendline and display the equation, then solve for X. This is a visual check, not a replacement for the formula.
Troubleshooting
- #N/A from MATCH. The target X is smaller than the first X value, or the X column is text. Check the data type and the sort order.
- #DIV/0!. x2 equals x1, which happens when the target sits at or beyond the last data point. Add a guard or extend the data.
- Result looks wrong. Verify that the Y column aligns with the X column row by row. A shifted paste is the usual culprit.
- Formula returns 0. One of the INDEX results is pulling an empty cell. Check that the ranges cover all rows.
- XLOOKUP or LET not recognised. Your Excel version is older. Use the INDEX/MATCH version in Step 4.
Frequently Asked Questions
Can Excel interpolate automatically?
No. Excel has no dedicated interpolation function. You build it with MATCH, INDEX and basic arithmetic as shown above.
What is the formula for linear interpolation?
y = y1 + (x - x1) × (y2 - y1) / (x2 - x1), where (x1,y1) and (x2,y2) are the two known points and x is the target value.
Does the X column have to be sorted?
Yes, for the MATCH approach with match type 1. If you cannot sort, use XLOOKUP with a different match mode or sort a copy of the data.
Can I interpolate more than one value at once?
Yes. Put the targets in a column, lock the data ranges with dollar signs, and copy the formula down.
What if my target is outside the data range?
The formula will error or extrapolate. Wrap it in IF to return a message such as "out of range" instead.
Does interpolation work with dates?
Yes, because Excel stores dates as serial numbers. Format the result as a date if the Y values are dates.