![]()
You can calculate row totals, column totals, and a grand total for a range of cell, all in one step.
Grand Total a range of cells
Note: Instead of typing the criterion in a formula, you can refer to a cell. For example, the formula in step 9 above could be changed to:
=SUMIF(A2:A10, B12, B2:B10)
if cell B12 contained the text pen.
You can add cells that contain a criterion as part of the cell's contents. In this example all Pen, Gel Pen, and Pencil orders will be summed, because they contain the string "pen".
- Select the cell in which you want to see the total (cell A12 in this example)
- Type an equal sign (=) to start the formula
- Type: SUMIF(
- Select the cells that contain the values to check for the criterion. In this example, cells A2:A10 will be checked
- Type a comma, to separate the arguments
- Type the criterion. In this example, you're checking for text, so type the word in double quotes, with one or more asterisk (*) wildcard characters: "*Pen*"
Note: upper and lower case are treated equally
- Type a comma, to separate the arguments
- Select the cells that contain the values to sum. In this example, cells B2:B10 will be summed
- Type a closing bracket. The completed formula is: =SUMIF(A2:A10,"*Pen*",B2:B10)
- Press the Enter key to complete the entry
- The result will be 53, the total of rows that contain the string, "Pen"
![]()
Note: Instead of typing the criterion in a formula, you can refer to a cell. For example, the formula in step 9 above could be changed to:
=SUMIF(A2:A10,"*" & B12 & "*",B2:B10)
if cell B12 contained the text pen.
Criterion and operator
You can use an operator with a criterion. In this example only the rows where the number of sales reps is greater than or equal to ten will be included in the total.
- Select the cell in which you want to see the total
- Type an equal sign (=) to start the formula
- Type: SUMIF(
- Select the cells that contain the values to check for the criterion. In this example, cells B2:B10 will be checked
- Type a comma, to separate the arguments
- Type the criterion. In this example, you're checking for rows where the number of visits is greater than or equal to 10. The >= operator is used before the number, and the entire criterion is enclosed in double quotes.
- Type a comma, to separate the arguments
- Select the cells that contain the values to sum
- Type a closing bracket. The completed formula is:
=SUMIF(B2:B10,">=10",C2:C10)
- Press the Enter key to complete the entry
- The result will be 183, the total of rows with ten or more sales reps.
![]()
Note: Instead of typing the criterion in a formula, you can refer to a cell. For example, the formula in step 9 above could be changed to:
=SUMIF(B2:B10,">=" & B12,C2:C10)
if cell B12 contained the number 10.
Sum cells that match multiple criteria -- SUMPRODUCT
Match multiple criteria
You can calculate a total for rows that meet two or more criteria. In this example only the rows where the status is "Active" and the number of visits is greater than or equal to ten will be included in the total.
- Select the cell in which you want to see the total
- Type an equal sign (=) to start the formula
- Type: SUMPRODUCT(--(
- Select the cells that contain the values to check for the first criterion. In this example, cells A2:A6 will be checked
- Type the first criterion: ="Active"
- Type ),--(
- Select the cells that contain the values to check for the second criterion. In this example, cells B2:B6 will be checked
- Type the second criterion: >=10
- Type ),--(
- Select the cells that contain the values to sum. In this example, cells C2:C6 will be summed
- Finish with closing brackets: ))
- The completed formula is:
=SUMPRODUCT(--(A2:A6="Active"), --(B2:B6>=10),--(C2:C6))
- Press the Enter key to complete the entry
Sum the Top 5 Numbers in a ListUse the SUM and LARGE functions together, to add the largest numbers in the list.
Version 1 -- Few Top Numbers
If a few numbers are to be summed, e.g. top 3, you can type the numbers into the formula. For example:
=SUM(LARGE(A1:A7,{1,2,3}))
The result is 70+60+50 = 180
Note: The second 50 is not included in the result, even though it is tied for 3rd place.
Version 2 -- Many Top Numbers
If many top numbers are to be summed you can include the INDIRECT function in the formula. In the INDIRECT function, use row numbers that represent the numbers you want to include. In this example, rows 1:10 are used, so the top 10 numbers in the referenced range will be summed.
- Type the formula:
=SUM(LARGE(A1:A50,ROW(INDIRECT("1:10"))))- This is an array formula, and must be array-entered. To do this, hold the Ctrl and Shift keys, and press Enter
Version 3 -- Variable Top Numbers
If a variable number of top numbers are to be summed you can include the INDIRECT function in the formula, as shown above, and refer to a cell that holds the variable..
Sum the Numbers in a Filtered ListAfter you filter the rows in a list, you can use the SUBTOTAL function to sum the numbers in the visible rows.
- Apply an AutoFilter to the table. There are instructions here -- AutoFilter Basics
- Filter at least one of the columns in the table. In this example, the first column has been filtered for Binders.
- Select the cell immediately below the column you want to sum.
- Click the AutoSum button on the Excel's Standard toolbar.
- If you want the SUBTOTAL function in a cell other than the one directly below the filtered list, you can type the formula, instead of using the AutoSum button.
- A SUBTOTAL formula will be automatically inserted, totalling the visible cells in the column
- The first argument in the SUBTOTAL function is a function number, that specifies how the numbers should be calculated. There is a 9 in this example, which tells Excel to SUM the numbers.
- Other function numbers can be used, such as 1 for AVERAGE, and 3 for COUNTA. Look in Excel's Help for a complete list.
- Press the Enter key to complete the formula entry.
Note: In Excel 2003, you can use the formula:
=SUBTOTAL(109,B2:B9)
to subtotal visible cells in a range where rows have been manually hidden, or filtered.
Last updated: July 18, 2008 11:40 PM