How to Find Average with OFFSET Function in Excel (3 Examples)

Suppose we have the dataset below of 6 employees’ sales in the first 4 months of a year. Let’s calculate the average sales for individual months and also the average sales of individual employees for the full 4 months using the OFFSET and AVERAGE functions.

Sample Dataset to Average with OFFSET Function in Excel


Method 1 – Calculate Average of Any Number of Rows/Columns Using the OFFSET Function

Steps:

  • Click on cell G5 and insert the following formula:
=AVERAGE(OFFSET(C5,0,0,1,4))
  • Press Enter.

Average Sales with OFFSET Function in Excel

The average sales for the employee Adam is returned.

  • Place your cursor in the bottom right position of the cell.
  • Drag the Fill Handle down to copy the formula to the rest of the cells in the series.

Drag Fill Handle Below

The average sales for all employees are returned.

  • To calculate the monthly average sales, click on cell C11 and insert the formula below:
=AVERAGE(OFFSET(C5,0,0,6,1))

Average Individual Employee's Sales with OFFSET Function

  • Press Enter.
  • Drag the Fill Handle right to copy the same formula for all the other months.

Drag Fill Handle Rightward

The result will look like this:

Average with OFFSET Function

Read More: How to Calculate VLOOKUP AVERAGE in Excel


Method 2 – Combining COUNT and OFFSET Functionsto Calculate Average of Last N Number of Rows/ Columns

Using the OFFSET function in combination with the COUNT function, we can calculate the average for N number of rows or columns dynamically.

2.1 – Average of Last N Rows

Steps:

  • Set the N value as 2 in cell C13.
  • Click on cell B13 and enter the following formula in the formula bar:
=AVERAGE(OFFSET(C4,COUNT(C4:C10)-C13+1,0,C13,4))
  • Press Enter.

Average Last N ROws with OFFSET Function in Excel

The average sales of the last two employees for all 4 months is returned. Change the value of N as required and the AVERAGE function will automatically return the exact result.


2.2 – Average of Last N Columns

Let’s calculate the average for all employees but only for the last two months.

Steps:

  • Set the N value as 2 in cell C13.
  • Insert the following formula in cell B13 and press Enter:
=AVERAGE(OFFSET(B5,0,COUNT(B5:F5)-C13+1,6,C13))

Average Last N Columns with OFFSET Function in Excel

The average sales for all employees for the last two months is returned. To calculate the average for any other number of months, simply change the N value accordingly.


Method 3 – Using OFFSET and ROW Functions to Calculate Average for Every N Number of Rows/Columns

You might need to calculate average sales in a consecutive manner, i.e. for every N number of rows or columns.

3.1 – Average of Every N Number of Rows

Let’s calculate average sales for every two employees in the dataset using the ROW function together with the OFFSET function.

Steps:

  • Click on cell C13 and insert the following formula:
=AVERAGE(OFFSET($C$5,(ROW()-ROW($C$13))*2,,2,))
  • Press Enter.

Formula to Average Every Two Employees Sales in January

The January average sales for Adam and Mathew is returned.

  • Drag the Fill Handle down to copy the formula to the cells below.

Drag Fill Handle Below

For the other months, dragging the Fill Handle won’t work properly due to our use of absolute references.

  • So, for the February sales average for every two employees, click on cell D13 and insert the following formula:
=AVERAGE(OFFSET($D$5,(ROW()-ROW($D$13))*2,,2,))
  • Press Enter.

Formula to Average Every Two Employees Sales in February

  • Repeat the same procedure for all the other cells, modifying your formula in the same way for every month.

The averages for every two rows every month are returned.

Average Every Two Rows in Excel with OFFSET Function

Read More: How to Average Every Nth Row in Excel


3.2 – Average of Every N Number of Columns

We can calculate the average for every employee every two months by combining the COLUMNS function with the OFFSET function.

Steps:

  • Click on cell C13 and insert the following formula:
=AVERAGE(OFFSET($C$5,,(COLUMNS($C$13:C13)-1)*2,,2))
  • Press Enter.

Average Sales For Adam for January & February

  • Drag the Fill Handle right to repeat the same result for the next two months.

Drag Fill Handle Rightward

Being an absolute reference, the formula won’t work properly if you drag the Fill Handle below for other employees.

  • For the next employee, click on cell C14 and enter the formula below in the formula bar:
=AVERAGE(OFFSET($C$6,,(COLUMNS($C$14:C14)-1)*2,,2))
  • Press Enter.

Average Sales for Mathew for January & February

  • Repeat the same dragging approach, changing the formula accordingly for each employee.

All employees’ average sales every two months are returned.

Average Sales for Each Employee Every Two Months with OFFSET Function in Excel


Things to Remember

  • The OFFSET function will return a #VALUE! error if any argument is invalid, like a missing cell reference.
  • The OFFSET function will return a #REF! error if you refer to any cell that is outside of the spreadsheet.

Download Practice Workbook


Related Articles

Get FREE Advanced Excel Exercises with Solutions!
Tanjim Reza
Tanjim Reza

Md. Tanjim Reza Tanim, a BUET graduate in Naval Architecture & Marine Engineering, contributed over one and a half years to the ExcelDemy project. As an Excel & VBA Content Developer, he authored 100+ articles and, as Team Leader, reviewed 150+ articles. Tanim, leading research, ensures top-notch content on MS Excel features, formulas, solutions, tips, and tricks. His expertise spans Microsoft Office Suites, Automating Finance Templates, VBA, Python, and Developing Excel Applications, showcasing a multifaceted commitment to the... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo