# FORECAST.LINEAR

The `FORECAST.LINEAR` function calculates the predicted value of the y-variable for a given value of the x-variable based on linear regression. It is commonly used to predict future trends based on existing data points.

## Usage

Use the `FORECAST.LINEAR` formula with the syntax shown below, it has 3 required parameters:

Parameters:
1. x (required):
The value for which you want to predict the y-value.
2. data_y (required):
The array or range containing the dependent variable (y-values) in the regression model.
3. data_x (required):
The array or range containing the independent variable (x-values) in the regression model.

## Examples

Here are a few example use cases that explain how to use the `FORECAST.LINEAR` formula in Google Sheets.

### Predicting future sales

If you have a set of sales data over a certain period of time, you can use `FORECAST.LINEAR` to predict future sales based on the existing data points.

### Predicting future website traffic

If you have website traffic data, you can use `FORECAST.LINEAR` to predict future traffic and plan for server capacity and bandwidth requirements.

### Predicting future inventory levels

If you have inventory data, you can use `FORECAST.LINEAR` to predict future inventory levels, which can help with planning for purchasing and manufacturing activities.

## Common Mistakes

`FORECAST.LINEAR` not working? Here are some common mistakes people make when using the `FORECAST.LINEAR` Google Sheets Formula:

### Incorrect order of data_x and data_y

The order of the data_y and data_x parameters must be the opposite of what is expected based on the natural order of the data. Make sure to input the data_y parameter first followed by the data_x parameter.

### Non-numeric or non-adjacent input data

The input data for the data_y and data_x parameters must be numeric and adjacent. Check that all input data is numeric and that there are no blank cells between the data.

### Insufficient data points

There must be at least two pairs of data points for the formula to work. Check that there are enough data points provided for the formula to work.

The following functions are similar to `FORECAST.LINEAR` or are often used with it in a formula:

• `LINEST`

The `LINEST` formula is used to calculate the statistics for a line by calculating the line's slope and y-intercept. It is commonly used to find the best-fit straight line for a given set of data points.

• `TREND`

The `TREND` formula is used to calculate future values based on historical data. It fits a straight line (using the method of least squares) to the arrays specified in the `known_data_y` and `known_data_x` parameters and then uses that line to calculate new y-values for the array specified in the `new_data_x` parameter. If `b` is set to TRUE, then the calculation will include the y-intercept of the line. This formula is commonly used in forecasting and trend analysis.

• `INTERCEPT`

The `INTERCEPT` function calculates the point where the line of best fit for a set of data intercepts the y-axis. This function is commonly used in regression analysis to find the constant b in the equation y=mx+b where m is the slope of the regression line.

• `SLOPE`

The `SLOPE` formula calculates the slope of the linear regression line that best fits the input data. It is commonly used in statistics to analyze trends and predict future values based on past performance.

You can learn more about the `FORECAST.LINEAR` Google Sheets function on Google Support.