Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Google Sheets FORECAST.LINEAR Guide and Examples

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

The FORECAST.LINEAR function in Google Sheets predicts a future value based on a linear trend from existing historical data. It calculates a straight line (linear regression) through your known data points and extends that line to find the value for a specific future date or point in time. This is essential for business forecasting, budget projections, and tracking growth patterns where the relationship between the time period and the result is relatively consistent.

What You'll Need

  • A Google account with access to Google Sheets.
  • A dataset containing at least two columns: one for the independent variable (usually time, dates, or sequence numbers) and one for the dependent variable (the values you want to predict, such as sales, temperature, or website traffic).
  • The specific target date or point in time for which you want to calculate the prediction.

Step-by-Step

  1. Organize Your Data: Arrange your historical data in two adjacent columns. Place your known "x-values" (the timeline) in one column and your known "y-values" (the results) in the next. For example, Column A could contain dates (January 1, February 1, March 1) and Column B could contain monthly revenue ($1,000, $1,200, $1,400). Ensure there are no empty rows within your data range, as this can cause calculation errors.
  2. Identify the Target Value: Decide which future point you are forecasting for. If your data is based on dates, enter the future date in a separate cell (e.g., Cell D1). If your data is based on a sequence (Month 1, Month 2), enter the target number (e.g., Month 6) in a cell.
  3. Insert the Function: Click on the cell where you want the predicted value to appear. Type =FORECAST.LINEAR( to begin the formula.
  4. Define the Target X: Immediately after the opening parenthesis, click the cell containing your target value (from Step 2). This tells Google Sheets, "I want to know the value for this specific point in time." Follow this with a comma.
  5. Select the Known Y Range: Now, highlight the range of cells containing your existing results (the dependent variables). For example, if your revenue is in cells B2 through B13, select B2:B13. Follow this with a comma.
  6. Select the Known X Range: Finally, highlight the range of cells containing your existing timeline (the independent variables). For example, if your dates are in cells A2 through A13, select A2:A13.
  7. Close and Execute: Close the parenthesis ) and press Enter. Google Sheets will now calculate the linear slope and intercept of your data and return the predicted value for your target x.

Common Mistakes

One of the most frequent errors is swapping the known_y's and known_x's ranges. The function specifically requires the results (Y) first and the timeline (X) second. If you reverse these, the formula will either return a mathematically incorrect number or a #VALUE! error because it is trying to treat your results as the timeline.

Another common mistake is using non-numeric data in the ranges. While Google Sheets can often handle dates (because it stores dates as numbers internally), it cannot handle text. If your "dates" are written as "January" or "February" instead of actual date formats (1/1/2023), the function will fail. Ensure your timeline is formatted as a Date or a Number.

Users also frequently forget that FORECAST.LINEAR assumes a straight line. If your data is exponential (growing faster and faster) or seasonal (peaking every December), a linear forecast will be wildly inaccurate. Using this function for a highly volatile stock price or a seasonal retail business without adjusting for seasonality will lead to misleading predictions.

Tips

To make your forecast dynamic, use cell references instead of hard-coding ranges. For example, instead of typing B2:B13, you can use named ranges. This allows you to add new data to your list without having to manually update every single formula in your spreadsheet.

Combine your forecast with a Scatter Chart to visualize the trend. Select your historical data, go to Insert > Chart, and choose "Scatter chart." Then, go to the Customize tab, select "Series," and check the "Trendline" box. This allows you to see if the data actually looks linear. If the dots form a curve rather than a line, you know that FORECAST.LINEAR is not the right tool for that specific dataset.

If you need to forecast multiple future periods at once, you can use an absolute reference for your known ranges. By adding dollar signs to your ranges (e.g., $B$2:$B$13, $A$2:$A$13), you can drag the fill handle down to apply the forecast to a whole column of future dates without the reference ranges shifting downward.

Troubleshooting

If you encounter a #N/A error, it usually means your known_y's and known_x's ranges are not the same size. For example, if you selected 12 cells for your revenue but only 11 cells for your dates, Google Sheets cannot pair the data points and will return an error. Check that both ranges start and end on the same row numbers.

If you see a #VALUE! error, check for hidden text or spaces in your data. A cell that looks empty but contains a space character can be interpreted as text, which breaks the mathematical calculation. Use the "Find and Replace" tool to remove unexpected characters or ensure the entire column is formatted as "Number" via the Format > Number menu.

If the resulting number seems impossibly high or low, double-check your target X value. If your historical data is in years (2020, 2021, 2022) but you accidentally entered the target X as a date (e.g., 1/1/2024), the function will treat the date as a massive number (the number of days since 1899), resulting in a prediction that is skewed far beyond reality.

Frequently Asked Questions

Does FORECAST.LINEAR account for seasonality?

No, this function only calculates a straight linear trend. It does not recognize patterns that repeat every year or month. For seasonal data, you would need more advanced statistical methods or a combination of linear forecasting and seasonal multipliers.

What is the difference between FORECAST and FORECAST.LINEAR?

In modern versions of Google Sheets, they are essentially the same. FORECAST.LINEAR is the updated name to be more explicit about the type of regression being used, while FORECAST is maintained for backward compatibility with older spreadsheet software.

Can I use this function for non-date timelines?

Yes. As long as your X-axis is numeric, it works. You can use it for things like "Number of Units Produced" vs "Total Cost," or "Hours Studied" vs "Test Score." The X-axis does not have to be time; it just needs to be a consistent numerical scale.

How many data points do I need for an accurate forecast?

Technically, you only need two points to draw a line. However, for a reliable prediction, you should have as many historical points as possible. The more data points you provide, the less a single "outlier" (an unusually high or low month) will distort the overall trend line.

Can I forecast backwards in time?

Yes. By entering a target X value that is smaller than your earliest known X value, the function will extend the linear trend line backward to estimate what the value would have been in the past.