How to Calculate Reverse Running Total in Google Sheets

Are you tired of calculating running totals in Google Sheets from top to bottom? Well, I have a juicy secret for you! I’ll show you how to calculate the reverse running total in Google Sheets with just a few clicks. So sit back, relax, and let’s dive in!

Why Reverse Running Total?

When you have your data sorted from newest to oldest, the reverse running total can be a game-changer. It provides you with a cumulative sum from the bottom to the top, giving you a better understanding of the data. Let’s take a practical example to illustrate this.

Imagine we have data on wheat production in Australia from 2010 to 2019. By arranging the data in descending order by year, we can easily calculate the reverse running total. Check out this example:

Reverse Running Total in Google Sheets

In the example above, columns A and B represent the years and the quantities of wheat production, respectively. Observe the values in columns C and D. Can you spot the difference?

In column C, you can see the running total calculated from top to bottom. However, in column D, the reverse running total is calculated from bottom to top. The reverse running total in column D tells you the cumulative wheat production up to that year from each row. Fascinating, right?

The Array Formula for Reverse Running Total

Now, let’s unveil the magic behind the reverse running total in Google Sheets. We’ll use an array formula, specifically the SUMIF formula. Here’s the syntax:

ArrayFormula(SUMIF(range, criterion, [sum_range]))

To calculate the reverse cumulative sum, we’ll use the sum_range B2:B. Now, you might be wondering about the range and the criterion. Don’t worry; I’ve got you covered.

First, make sure column D is empty because we’ll insert our array formula in cell D1. This requires an empty column to work without any errors. Alright, here’s the formula for cell D1:

={"Reverse Running Total";ArrayFormula(If(B2:B="",,SUMIF(sort(row(A2:A),1,0),"<="&sort(row(A2:A),1,0),B2:B)))}

This array formula will return the reverse running total in Google Sheets for the range B2:B. One remarkable advantage of this formula is that it works for all rows in column D. No need to drag it down manually. Just ensure there are values in column B. Blank rows will be ignored.

Pro Tip: This formula will also work: ={"Reverse Running Total";ArrayFormula(If(B2:B="",,SUMIF(row(A2:A),">="&row(A2:A),B2:B)))}. However, the explanation will be based on the first formula above.

Formula Explanation

Let’s break down the formula into three parts for easier understanding:

Part 1: ArrayFormula

  • Helps the SUMIF function return an array result. This is necessary for the IF function as well.

Part 2: IF

  • Limits the output to rows that contain values in column B.

Part 3: SUMIF

  • Returns the reverse running total in Google Sheets.

Now, let’s remove the unwanted string from the formula, which is the header “Reverse Running Total,” and make the ranges closed. We’ll also use a helper column for clarity. Check out the refined formula:

ArrayFormula(If(B2:B11="",,SUMIF(C2:C11,"<="&C2:C11,B2:B11)))

Here’s the breakdown of the parts:

  • Part 1: ArrayFormula
  • Part 2: IF
  • Part 3: SUMIF

Note: In the main formula, we used sort(row(A2:A),1,0) instead of the temporary helper range C2:C11. Please refer to the image above for a visual representation.

To fully grasp how the SUMIF formula returns the reverse running total in Google Sheets, let’s test it in a specific row, such as row #5:

=SUMIF(C2:C11,"<="&C5,B2:B11)

The formula will return the total wheat production in Australia from 2010 to 2016 (highlighted cells). The criterion, C2:C11<=C5, matches the highlighted rows in column C.

And there you have it! You now know the secret to calculating the reverse running total in Google Sheets. Enjoy exploring your data in a whole new way!

Resources:

So go ahead and conquer your data analysis tasks with this reverse running total formula in Google Sheets! If you want to discover more helpful tips and tricks, head over to Crawlan.com. Remember, knowledge is power!

Related posts