Skip to main content
Bob Umlas/3 min read

Creating Grand Totals in Excel

Build a Dashboard

1

Source Sheet

Raw data lives on its own tab — never touched after import.

2

Pivot Sheet

Pivot tables that summarize the source data.

3

Dashboard Tab

Charts, slicers, and KPIs that draw from the pivots.

4

Refresh on Open

Right-click pivot → PivotTable Options → Refresh on open.

Master Excel at Noble Desktop

Noble Desktop's Excel Bootcamp covers formulas, pivot tables, data analysis, and VBA.

Explore various formulas to calculate the grand total in an Excel worksheet, discussing alternative methods, the potential for errors, and the optimal solution.

Suppose you have a worksheet which looks something like this:

Excel worksheet with multiple sections of data and subtotal rows requiring a grand total

Clearly, what’s needed is the grand total in cell B38. But what is the formula which goes there? Notice that there are several subtotals in the list. The formula in cell B9, for example, is =SUM(B4:B8). How many of you would use the formula =B3+B9+B14+B20+B25+B32+B37 to solve the problem?

Excel formula bar showing a long manual formula summing individual subtotal cells for the grand total

I’ve seen formulas like this many times, and often a lot longer because the list is longer. It does work, producing the correct answer, but it’s tedious to do and certainly subject to errors because you might click the wrong cell.

In this article I’ll describe a few alternative ways to do this, leaving the best for last!

The first way is probably the easiest, but the formula is perhaps just as long. While the cell B38 is selected, press ALT/= (that is, hold the ALT key down and press the = sign). This creates this formula:

Excel formula created by ALT+= shortcut automatically detecting and summing all subtotal cells

Wow! That’s cool! Excel “finds” all the other Sum formulas and picks out the correct cells! Not likely to produce an error! But there’s no hunting for the correct cells to use. One down side to this technique is that it won’t work on a range which is horizontal, only vertical, as this one is.

Let’s look at some shorter ones:

SUMIF formula in Excel that sums values where column A contains the word Subtotal

This doesn’t look much shorter, but it’s pretty much the same size no matter how many cells are involved. So it’s definitely shorter than something like =B1+B6+B11+B17+B20+B26+B32+B37+B40+B44+B50+B54+B60+B66+B81+B90+B99+B106+B112+B121+B126+B130+B134+B154+B159+B144+B176+B188+B192+B198+B206!


And I’ve seen longer! (4 lines’ worth!)

OK, what is SUMIF? It’s a built-in Excel function which works like this: Wherever the first range (A1:A37) contains the word “Subtotal”, add the values from the 2nd range (the 3rd parameter). The actual syntax is:

SUMIF function syntax explanation showing sum_range, criteria_range, and criteria parameters

That’s pretty cool too! But this could also lead to an error if somewhere in column A the word Subtotal were misspelled, or contained a space at the end (“Subtotal ”)!

There’s also SUMPRODUCT:

SUMPRODUCT formula using the N function to convert TRUE/FALSE to 1/0 for summing subtotals

Each array must be a numeric array. The solution in this case is =SUMPRODUCT(N(A1:A37=”Subtotal”), B1:B37).

The N function changes TRUE to 1 and FALSE to 0. Without it, the array would be full of TRUE/FALSE values and that’s not numeric, and it would give a 0 for an answer!

OK, ready for the winner? Make sure you’re sitting down first.

How about =SUM(B1:B37)/2:

Excel cell showing the simple formula =SUM(B1:B37)/2 producing the correct grand total


What? How can that work?

Well, let’s look at the formula in B37, for example:

Excel section showing individual values B33 through B36 totaling 2131 and the subtotal in B37 also showing 2131

That’s adding up the values in B33:B36. Those values total 2,131. If I add the values in B33 thru B37 (including the subtotal), I get 4,262 – the 2,131 from B33:B36 and the same 2,131 from B37. So I’m adding the values in twice! If I divide by 2, I get the right answer! Each of the sections containing the subtotal had the values in there twice – the individual values plus the subtotal! So dividing by 2 solves the problem!

This makes the technique work horizontally as well, using a formula something like =SUM(A2:AK2)/2.

Here’s the same data we were looking at, but turned on its side:

Same data arranged horizontally with the =SUM/2 formula producing the same grand total result

Clearly, we get the same answer!

No more lonnnngggggg formulas to do this task!