# Sumif Function

You use the SUMIF function to sum the values in a range that meet criteria that you specify. For example, suppose that in a column that contains numbers, you want to sum only the values that are larger than 5. You can use the following formula: =SUMIF(B2:B25,”>5″)

This video is part of a training course called Add numbers in Excel.

Contents

## Tips:

1. If you want, you can apply the criteria to one range and sum the corresponding values in a different range. For example, the formula =SUMIF(B2:B5, “John”, C2:C5) sums only the values in the range C2:C5, where the corresponding cells in the range B2:B5 equal “John.”
2. To sum cells based on multiple criteria, see SUMIFS function.

Important: The SUMIF function returns incorrect results when you use it to match strings longer than 255 characters or to the string #VALUE!.

## Syntax

SUMIF(range, criteria, [sum_range])

The SUMIF function syntax has the following arguments:

• 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. The selected range may contain dates in standard Excel format (examples below).
• 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. Wildcard characters can be included – a question mark (?) to match any single character, an asterisk (*) to match any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) preceding the character.For example, criteria can be expressed as 32, “>32”, B5, “3?”, “apple*”, “*~?”, 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 the sum_range argument is omitted, Excel adds the cells that are specified in the range argument (the same cells to which the criteria is applied).Sum_range should be the same size and shape as range. If it isn’t, performance may suffer, and the formula will sum a range of cells that starts with the first cell in sum_range but has the same dimensions as range. For example:rangesum_rangeActual summed

## Example 1

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

## Example 2

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

## Need more help?

You can always ask an expert in the Excel Tech Community, get support in the Answers community, or suggest a new feature or improvement on Excel User Voice.

The SUMIFS function adds all arguments that meet multiple criteria

The SUMSQ function sums multiple values after it performs a mathematical square operation on each of them

The COUNT-IF function counts only the values that meet a single criteria

The COUNT IFS function counts only the values that meet multiple criteria

IFS function (Office 365, Excel 2016 and later)

Overview of formulas in Excel

How to avoid broken formulas

Detect errors in formulas

Math & Trig functions

Excel functions (alphabetical)

Excel functions (by Category)

Using SUM-IF, COUNT-IF, and related functions for quick data analysis (free preview)