# Excel Tip: How to sum a column based on multiple conditions or criteria in other columns

Have you ever wanted to sum a column of values but want to do it only on certain conditions? When using Microsoft Excel, this can be done using some formula and formula combinations.

Suppose you have a column of names and values and you want to sum up the figures for a certain name. Here is a sample of sales data.

In the sample data above, we are supposed to calculate the total for the four (4) sales persons. In this case, we cannot simply sum the entire figures in column D as there are 4 sales persons in column. That kind of sum will be for all sales persons, but what we need is the total sales of every sales person.

### Using the SUMIF formula

We can computer this kind of conditional sum using the SUMIF formula. Given the sample data above, here are the formulas

**To sum up total sales for Paul A:**

=SUMIF(C3:C22,"=Paul A",D3:D22)

**To sum up total sales for Eric A:**

=SUMIF(C3:C22,"=Eric A",D3:D22)

**To sum up total sales for James C:**

=SUMIF(C3:C22,"=James C",D3:D22)

**To sum up total sales for John T:**

=SUMIF(C3:C22,F6,D3:D22)

### SUMIF Formula Usage

You use the SUMIF function to sum the values in a range that meet criteria that you specify.

## Syntax

SUMIF(range, criteria, [sum_range])

The **SUMIF** function syntax has the following arguments (argument: A value that provides information to an action, an event, a method, a property, a function, or a procedure.):

**range**(Required): The range of cells that you want evaluated by criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored. NOTE:**This is not the actual cells to be added.****criteria**(Required): The criteria in the form of a number, expression, a cell reference, text, or a function that defines which cells will be added. For example, criteria can be expressed as 32, ">32", B5, 32, "32", "apples", or TODAY().

**IMPORTANT:** Any text criteria or any criteria that includes logical or mathematical symbols must be enclosed in double quotation marks ("). If the criteria is numeric, double quotation marks are not required.

**sum_range**(Optional): The actual cells to add, if you want to add cells other than those specified in the range argument. If theargument is omitted, Excel adds the cells that are specified in the*sum_range*argument (the same cells to which the criteria is applied).*range*

Suppose further that another column is added for QUARTER. And then you need to calculate the total sales per sales person and per quester. Thus, you will have two (2) conditions this time.

### Using SUMIFS for Multiple Conditions

In this case where multiple conditions are required to be met, SUMIFS will be used. SUMIFS function simply adds numbers based on multiple criteria.

## Syntax

SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)

The SUMIFS function syntax has the following arguments (argument: A value that provides information to an action, an event, a method, a property, a function, or a procedure.):

**sum_range**(Required): One or more cells to sum, including numbers or names, ranges, or**cell references**(cell reference: The set of coordinates that a cell occupies on a worksheet. For example, the reference of the cell that appears at the intersection of column B and row 3 is B3.) that contain numbers. Blank and text values are ignored.**criteria_range1**(Required): The first range in which to evaluate the associated criteria.**criteria1**(Required): The criteria in the form of a number, expression, cell reference, or text that define which cells in theargument will be added. For example, criteria can be expressed as 32, ">32", B4, "apples", or "32."*criteria_range1***criteria_range2, criteria2, …**Optional. Additional ranges and their associated criteria. Up to 127 range/criteria pairs are allowed.

To computer the total sales for Paul A for the first quarter in our sample data, the formula is:

=SUMIFS($D$3:$D$22,$C$3:$C$22,$G10,$E$3:$E$22,H9)

In that formula, cell ranges are locked (indicated by the $ signs) since they are not intended to change when you drag the formulas across or downwards. When interpreted, the formula simply ADDS the numbers in the range D3:D22 if:

- Check column C for "Paul A" and the corresponding D value will be added to the SUM
- Check column E and see if it is I, II, III or IV and perform the sum accordingly.

Below is the completed sample file that you can download.