Calculating Running Average in Google Sheets (Array Formulas)

Published on

We can use the AVERAGE function to calculate the running average in Google Sheets, which is simply the cumulative average from the first value up to the current position in the dataset.

Calculating a running average involves updating the average as new values are added, which calls for dynamic formulas—especially in expanding datasets.

You can use modern functions like MAP and LAMBDA, or classic options like SUMIF, MMULT, and DAVERAGE.

In this guide, we’ll focus specifically on how to calculate the running average in Google Sheets. But to help you distinguish it from other commonly used averages—like rolling or moving averages—here’s a quick reference:

TermTypical MeaningExample Cell Ranges
Rolling AverageAverage over a sliding window (e.g., 3 rows), moves down one row at a time.A1:A3, A2:A4, A3:A5, …
Moving AverageAverage of the most recent N values in a growing dataset.A3:A5 (last 3 non-blank cells)
Running AverageCumulative average from the first row to the current row.A1:A1, A1:A2, A1:A3, …
Average of Every N RowsAverage calculated in non-overlapping chunks of N rows.A1:A3, A4:A6, A7:A9, …

Introduction

An average (arithmetic mean) is a single number that represents the central tendency of a dataset. It’s calculated by adding all values and dividing by the count.

Example: If attendance at your last four weekly meetings was 5, 4, 4, and 6:

=AVERAGE(5, 4, 4, 6) → 4.75

When another meeting occurs with 5 attendees:

=AVERAGE(5, 4, 4, 6, 5) → 4.8

You’re now calculating a running average — expanding the average range as new values appear. Let’s see how to implement this dynamic cumulative average in Google Sheets.

Two Approaches to Calculate Running Average in Google Sheets

You can calculate the running average in Google Sheets using:

  1. Non-array formulas — use a fill-down formula.
  2. Array formulas — calculate for all rows at once using a dynamic formula.

Cumulative Average Using a Non-Array Formula

Assume weekly meeting dates are in column A, and attendance is in column B.

Use this formula in C2, then drag it down:

=AVERAGE($B$2:B2)

This formula computes the average from the first row down to the current row. It ignores blanks but includes 0 values.

GIF showing how to calculate the running average in Google Sheets using a drag-down AVERAGE formula

Running Average in Google Sheets Using Array Formulas

Let’s now look at dynamic, auto-expanding formulas. These running average array formulas in Google Sheets update automatically as data changes.

Note: The MMULT and DAVERAGE versions may be slower in large datasets.

You can enter each of the following formulas in cell C2.

1. Running Average Using MAP

=MAP(SEQUENCE(ROWS(B2:B)), LAMBDA(r, IF(INDEX(B2:B, r)="",,AVERAGE(ARRAY_CONSTRAIN(B2:B, r, 1)))))

Explanation:

  • SEQUENCE(ROWS(B2:B)) generates a list of row numbers from 1 to n.
  • MAP loops over these numbers and applies the LAMBDA function.
  • INDEX(B2:B, r) checks whether the cell in row r is blank.
  • ARRAY_CONSTRAIN(B2:B, r, 1) limits the input to the first r values of B2:B.
  • AVERAGE(...) computes the cumulative average up to that row.

This is one of the most elegant and efficient running average array formulas in Google Sheets.

2. Running Average Using SUMIF

=ArrayFormula(
  IF(B2:B="",,
    SUMIF(ROW(B2:B), "<=" & ROW(B2:B), B2:B) /
    COUNTIFS(B2:B, "<>", ROW(B2:B), "<=" & ROW(B2:B))
  )
)

Explanation:

SUMIF(ROW(B2:B), "<=" & ROW(B2:B), B2:B) calculates the running sum by summing all rows up to the current one.

COUNTIFS(B2:B, "<>", ROW(B2:B), "<=" & ROW(B2:B)) counts how many non-blank values exist up to each row.

Their division returns the cumulative average in Google Sheets.

If you’d like to explore how these components work in detail, here are two helpful guides:

3. Running Average Using MMULT

=ArrayFormula(
  IF(B2:B="",,
    MMULT(N(ROW(B2:B) >= TRANSPOSE(ROW(B2:B))), N(B2:B)) /
    COUNTIFS(B2:B, "<>", ROW(B2:B), "<=" & ROW(B2:B))
  )
)

Explanation:

ROW(B2:B) >= TRANSPOSE(ROW(B2:B)) creates a lower triangular matrix of TRUE values, where each row includes all previous rows (and itself).

TRUEFALSEFALSEFALSEFALSEFALSEFALSE
TRUETRUEFALSEFALSEFALSEFALSEFALSE
TRUETRUETRUEFALSEFALSEFALSEFALSE
TRUETRUETRUETRUEFALSEFALSEFALSE
TRUETRUETRUETRUETRUEFALSEFALSE
TRUETRUETRUETRUETRUETRUEFALSE
TRUETRUETRUETRUETRUETRUETRUE

Wrapping it with N(...) converts the TRUE/FALSE matrix into 1s and 0s.

MMULT(..., N(B2:B)) performs matrix multiplication to return the cumulative sums up to each row.

COUNTIFS(...) again counts how many non-blank values exist from the start up to each row.

Their division gives the running average.

This is a compact and clever running average array formula in Google Sheets, but it may be resource-intensive on large datasets.

The cumulative sum and running count logic used here is the same as in the SUMIF approach above. For detailed explanations, refer to the tutorials linked in that section.

4. Running Average Using DAVERAGE

=ArrayFormula(
  IF(B2:B="",,
    DAVERAGE(
      IFNA(VSTACK(, IF(ROW(B2:B) <= TRANSPOSE(ROW(B2:B)), B2:B, ""))),
      SEQUENCE(ROWS(B2:B), 1),
      VSTACK(IF(,,), IF(,,))
    )
  )
)

Explanation:

This formula takes a database-style approach to calculating the running average in Google Sheets.

IF(ROW(B2:B) <= TRANSPOSE(ROW(B2:B)), B2:B, "") builds a triangular structure where each column contains all values from the first row up to that row.
→ Learn more: Get 1-12-123-1234 Patterns Using an Array Formula in Google Sheets

5555555
111111
66666
10101010
555
11
2

VSTACK(,) adds an empty row as a header to satisfy DAVERAGE’s requirement for a field name.

SEQUENCE(ROWS(B2:B), 1) generates a column index for each set of cumulative values.

VSTACK(IF(,,), IF(,,)) provides a blank criteria range so DAVERAGE can compute each column’s average.

This is a creative and less conventional running average array formula. It’s quite resource-intensive but demonstrates the flexibility of database functions in Google Sheets.

Final Thoughts

Here’s a quick summary:

Formula TypeBest For
=AVERAGE($B$2:B2)Simple drag-down use cases
MAP + ARRAY_CONSTRAINClean, modern, and efficient array formula
SUMIF + COUNTIFSReliable and non-LAMBDA array formula
MMULTConcise but heavy on resources
DAVERAGECreative use of built-in database tools

Each of these methods offers a valid way to compute a running average in Google Sheets, depending on your preference for array formulas, readability, or performance.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Top Discussions

More like this

Pivot Table Formatting, Output & Special Behavior in Google Sheets

Pivot Tables in Google Sheets are powerful—but they can get tricky once you move...

Pivot Table Calculations & Advanced Metrics in Google Sheets

When it comes to built-in tools for data analysis and visualization in Google Sheets,...

Google Sheets Pivot Table Tutorial: Basics, Setup, and Date Grouping

The easiest way to summarize, analyze, and report data in Google Sheets is by...

3 COMMENTS

  1. Thank you for these solutions. I would very much appreciate it if you can help.

    Can the cumulative running average be turned into a rolling “n” period average?

    For example, 7 cells or 25 cells in the column? So as new data is added the formula calculates the “n” period average on an ongoing rolling basis?

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.