In Excel, the SumIf function adds all numbers in a range of cells, based on a given criteria.
The syntax for the SumIf function is:
SumIf( range, criteria, sum_range )
range is the range of cells that you want to apply the criteria against.
criteria is used to determine which cells to add.
sum_range are the cells to sum.
Applies To:
- Excel 2007, Excel 2003, Excel XP, Excel 2000
For example:
Let's take a look at an example:
Based on the Excel spreadsheet above:
=SumIf(A2:A6, D2, C2:C6) would return 218.6 =SumIf(A:A, D2, C:C) would return 218.6 =SumIf(A2:A6, 2003, C2:C6) would return 7.2 =SumIf(A2:A6, ">=2001", C2:C6) would return 12.6
Using Named Ranges
You can also use a named range in the SumIf function. For example, we've created a named range called family that refers to column A in Sheet 1.
Then we've entered the following data in Excel:
Based on the Excel spreadsheet above:
=SumIf(family, C2, B:B) would return 218.6 =SumIf(family, ">=2001", B:B) would return 12.6
To view named ranges: Under the Insert menu, select Name > Define.