If you are looking for ways to calculate autocorrelation in Excel, then you will find this article useful. Autocorrelation or serial correlation is helpful to determine the relationship between a data series over time with its lagged version by different amounts.

So, letâ€™s dive into the main article to know more about this issue.

**Table of Contents**hide

## Download Workbook

## 2 Ways to Calculate Autocorrelation in Excel

Here, we have the following dataset containing the sales records over different months of a company. We will try to determine the autocorrelation for different lags in these records between these time ranges using the following 2 ways.

We have used *Microsoft Excel 365* version here, you can use any other versions according to your convenience.

__Method-1__: Using SUMPRODUCT, OFFSET, AVERAGE, and DEVSQ Functions to Calculate Autocorrelation

Here, we will use the combination of the **SUMPRODUCT**, **OFFSET**, **AVERAGE**, and **DEVSQ** functions to calculate the autocorrelation of the sales values for a range of lags between **1 **to **5**.

** Steps**:

Firstly, we need to calculate the total number of months for determining the time series of the sales values.

âž¤ Type the following function in cell

**D13**.

`=COUNTA(B4:B12)`

**COUNTA** will determine the total months in the range **B4:B12**.

âž¤ After pressing **ENTER**, you will get the total number of months; **9**.

Now, we will determine the autocorrelations for the sales series between the lags **1** to **5**.

âž¤ Write down the following formula in cell **G4**.

`=SUMPRODUCT(OFFSET($D$4:$D$12,0,0,$D$13-F4)-AVERAGE($D$4:$D$12),OFFSET($D$4:$D$12,F4,0,$D$13-F4)-AVERAGE($D$4:$D$12))/DEVSQ($D$4:$D$12)`

Here, **$D$4:$D$12 **is the **Sales **range, **$D$13 **is the total number of months, and **F4 **is the lag value.

`$D$13-F4`

`becomes`

`9-1 â†’ 8`

`OFFSET($D$4:$D$12,0,0,$D$13-F4)`

`becomes`

`OFFSET($D$4:$D$12,0,0,8) â†’`

`extracts a range with a height of`

`8`

`rows from the reference cell`

`$D$4`

`.`

`Output â†’`

`{4996; 4137; 3203; 3403; 4831; 4931; 4753; 4381}`

`AVERAGE($D$4:$D$12) â†’`

`determines the average value of this range`

`Output â†’`

`4367.555`

`OFFSET($D$4:$D$12,0,0,$D$13-F4)-AVERAGE($D$4:$D$12)`

`becomes`

`{4996; 4137; 3203; 3403; 4831; 4931; 4753; 4381}-4367.555`

`Output â†’`

`{628.444; -230.556; -1164.556; -964.556; 463.444; 563.444; 385.444; 13.444}`

`OFFSET($D$4:$D$12,F4,0,$D$13-F4)`

`becomes`

`OFFSET($D$4:$D$12,1,0,8) â†’`

`the starting cell reference moves`

`1`

`cell downwards from`

`$D$4`

`and then extracts a range with a height of`

`8`

`rows from the reference cell`

`$D$5`

`Output â†’`

`{4137; 3203; 3403; 4831; 4931; 4753; 4381; 4673}`

`OFFSET($D$4:$D$12,F4,0,$D$13-F4)-AVERAGE($D$4:$D$12)`

`becomes`

`{4137; 3203; 3403; 4831; 4931; 4753; 4381; 4673}-4367.555`

`Output â†’`

`{ -230.556; -1164.556; -964.556; 463.444; 563.444; 385.444; 13.444; 305.444}`

`SUMPRODUCT(OFFSET($D$4:$D$12,0,0,$D$13-F4)-AVERAGE($D$4:$D$12),OFFSET($D$4:$D$12,F4,0,$D$13-F4)-AVERAGE($D$4:$D$12))`

`becomes`

`SUMPRODUCT({628.444; -230.556; -1164.556; -964.556; 463.444; 563.444; 385.444; 13.444},{ -230.556; -1164.556; -964.556; 463.444; 563.444; 385.444; 13.444; 305.444})`

`Output â†’`

`1287454.358`

`DEVSQ($D$4:$D$12) â†’`

`returns the sum of squares of the deviations of the data range from their mean.`

`Output â†’`

`3508950.222`

`SUMPRODUCT(OFFSET($D$4:$D$12,0,0,$D$13-F4)-AVERAGE($D$4:$D$12),OFFSET($D$4:$D$12,F4,0,$D$13-F4)-AVERAGE($D$4:$D$12))/DEVSQ($D$4:$D$12)`

`becomes`

`1287454.358/3508950.222`

`Output â†’`

`0.366905848`

âž¤ Press **ENTER **and drag down the **Fill Handle **tool.

After that, you will get the autocorrelations for the monthly sales series between a range of lags from **1 **to **5**.

**Read More: How to Find Correlation between Two Variables in Excel**

**Similar Readings**

**How to Calculate Cross Correlation in Excel (2 Quick Ways)****Calculate Correlation Coefficient in Excel (3 Methods)****How to Calculate Spearman Correlation in Excel (3 Easy Methods)**

__Method-2__: Using SUMPRODUCT, AVERAGE, VAR.P Functions to Calculate Autocorrelation in Excel

In this section, we are going to use the combination of **SUMPRODUCT**, **AVERAGE**, and **VAR.P** functions to have the autocorrelation for the monthly sales series with their lagged versions for lag values ** 1**,

**, and**

*2***.**

*3*** Steps**:

âž¤ Type the following function in cell

**D13**to determine the total number of rows in the data series.

`=COUNTA(B4:B12)`

**COUNTA **will determine the total months in the range **B4:B12**.

âž¤ After pressing **ENTER**, you will get the total number of months; **9**.

Itâ€™s time to determine the autocorrelations for the sales series between the lags **1** to **3**.

âž¤ Type the following formula in cell **G4**.

`=(SUMPRODUCT(D4:D11-AVERAGE(D4:D12),D5:D12-AVERAGE(D4:D12))/D13/VAR.P(D4:D12))`

Here, **D4:D11 **is the **Sales **range without the last cell value due to lag **1**, similarly, **D5:D12 **is the **Sales **range without the first cell value due to lag **1**, and **D13 **is the total number of months.

`AVERAGE(D4:D12) â†’`

`determines the average value of this range`

`Output â†’`

`4367.555`

`D4:D11-AVERAGE(D4:D12)`

`becomes`

`{4996; 4137; 3203; 3403; 4831; 4931; 4753; 4381}-4367.555`

`Output â†’`

`{628.444; -230.556; -1164.556; -964.556; 463.444; 563.444; 385.444; 13.444}`

`D5:D12-AVERAGE(D4:D12)`

`becomes`

`{4137; 3203; 3403; 4831; 4931; 4753; 4381; 4673}-4367.555`

`Output â†’`

`{ -230.556; -1164.556; -964.556; 463.444; 563.444; 385.444; 13.444; 305.444}`

`SUMPRODUCT(D4:D11-AVERAGE(D4:D12),D5:D12-AVERAGE(D4:D12))`

`becomes`

`SUMPRODUCT({628.444; -230.556; -1164.556; -964.556; 463.444; 563.444; 385.444; 13.444},{ -230.556; -1164.556; -964.556; 463.444; 563.444; 385.444; 13.444; 305.444})`

`Output â†’`

`1287454.358`

`SUMPRODUCT(D4:D11-AVERAGE(D4:D12),D5:D12-AVERAGE(D4:D12))/D13`

`becomes`

`1287454.358/9`

`Output â†’`

`143050.484224966`

`P(D4:D12) â†’`

`determines variance based on the entire range.`

`Output â†’`

`389883.358024691`

`(SUMPRODUCT(D4:D11-AVERAGE(D4:D12),D5:D12-AVERAGE(D4:D12))/D13/VAR.P(D4:D12))`

`becomes`

`(143050.484224966/389883.358024691)`

`Output â†’`

`0.366905848`

`Â`

âž¤ Press **ENTER**.

In this way, you will get the autocorrelation of the sales series with their one lagged version.

Similarly, to get the autocorrelation for lag=2 use the following formula.

`=(SUMPRODUCT(D4:D10-AVERAGE(D4:D12),D6:D12-AVERAGE(D4:D12))/D13/VAR.P(D4:D12))`

**D4:D10 **represents the sales series without the last two values due to lag 2 and **D6:D12 **is the series without the first two values.

In the same way, you can have the autocorrelation for lag=3 by applying the following formula.

`=(SUMPRODUCT(D4:D9-AVERAGE(D4:D12),D7:D12-AVERAGE(D4:D12))/D13/VAR.P(D4:D12))`

**D4:D9 **represents the sales series without the last three values due to lag 3 and **D7:D12 **is the series without the first three values.

**Read More:**** How to Do Correlation in Excel (3 Easy Methods)**

## Comparison of Results with Graphical Representation

As you can see, by using the above two formulas in two methods we are getting exactly the same autocorrelation values for their corresponding lags. Moreover, it can be concluded that with the increasing lagged values we are having a series of decreased autocorrelations.

For the lag value **1, **we are having a positive value which represents a proportionate increase in this time interval. And, for the rest of the lag values, we are having negative autocorrelations defining a proportionate decrease in the time intervals.

## Practice Section

For doing practice by yourself we have provided a** Practice** section like below in a sheet named **Practice**. Please do it by yourself.

## Conclusion

In this article, we tried to cover the ways to calculate autocorrelation in Excel. Hope you will find it useful. If you have any suggestions or questions, feel free to share them in the comment section.

## Related Articles

**How to Calculate P Value for Spearman Correlation in Excel****Make a Correlation Matrix in Excel (2 Handy Approaches)****How to Interpret Correlation Table in Excel (A Complete Guideline)****Calculate Pearson Correlation Coefficient in Excel (4 Methods)****How to Make a Correlation Scatter Plot in Excel (2 Quick Methods)**