To sum amounts based on a date range, you can use the SUMIFS function in Excel 2007 or later versions. Watch this video to see the steps, and the written instructions are below the video. Show
Sum Amounts in a Date RangeTo total the amounts in a specific date range, use the SUMIFS function (Excel 2007 and later) or the SUMIF function. There are two examples below: - - In this example, a Start date and an End date are entered on the worksheet. Dates are in column A, and units sold are in column B. See more Date Range examples on the Sum or Count for a Date Range page. Use SUMIFS to Calculate Total for a Date RangeFor Excel 2007, and later versions, you can use the SUMIFS function to calculate a total based on multiple criteria. We'll use a SUMIFS formula to total all the units where the sales date is:
Here is the formula that is entered in cell D5: =SUMIFS($B$2:$B$9,$A$2:$A$9,">=" & $D$2, $A$2:$A$9,"<=" & $E$2)
In this example, the result for the selected date range is a total of 494 units sold. To verify, you can select cells B3:B6, and look at the total shown in Excel's Status Bar. To get the total units for a different date range, change the Start date in cell D2, and/or the End date in cell E2. The SUMIF function sums cells in a range that meet a single condition, referred to as criteria. The SUMIF function is a common, widely used function in Excel, and can be used to sum cells based on dates, text values, and numbers. Note that SUMIF can only apply one condition. To sum cells using multiple criteria, see the SUMIFS function. SyntaxThe generic syntax for SUMIF looks like this:
The SUMIF function takes three arguments. The first argument, range, is the range of cells to apply criteria to. The second argument, criteria, is the criteria to apply, along with any logical operators. The last argument, sum_range, is the range that should be summed. Note that sum_range is optional. If sum_range is not provided, SUMIF will sum cells in the first argument, range. Examples: | | | | | | Applying criteriaThe SUMIF function supports logical operators (>,<,<>,=) and wildcards (*,?) for partial matching. The tricky part about using the SUMIF function is the syntax needed to apply criteria. This is because SUMIF is in a group of eight functions that split logical criteria into two parts, range and criteria. Because of this design, operators need to be enclosed in double quotes (""). The table below shows examples of the syntax needed for common criteria: TargetCriteriaCells greater than 75">75"Cells equal to 100100 or "100"Cells less than or equal to 100"<=100"Cells equal to "Red""red"Cells not equal to "Red""<>red"Cells that are blank """"Cells that are not blank"<>"Cells that begin with "X""x*"Cells less than A1"<"&A1Cells less than today"<"&TODAY()Notice the last two examples involve concatenation with the ampersand (&) character. Any time you are using a value from another cell, or using the result of a formula in criteria with a logical operator like "<", you will need to concatenate. This is because Excel needs to evaluate cell references and formulas to get a value before that value can be joined with an operator. LimitationsThere are a couple of limitations with SUMIF that you should be aware of. First, SUMIF only supports a single condition. If you need to sum cells using multiple criteria, use the SUMIFS function. Second, the SUMIF function requires an actual range for the range argument; you can't substitute an array. This means you can't do things like extract the year from a range that contains dates inside the SUMIF function. If you need to manipulate values that appear in the argument before applying criteria, the SUMPRODUCT function is a flexible solution. Basic usageWith numbers in the range A1:A10, you can use SUMIF to sum cells greater than 5 like this:
If the range B1:B10 contains color names like "red", "blue", and "green", you can use SUMIF to sum numbers in A1:A10 when the color in B1:B10 is "red" like this:
Notice A1:A10 is now entered as the sum_range, because it is different from range, which contains only color names. To recap: criteria is applied to cells in range. When cells in range meet criteria, corresponding cells in sum_range are summed. The sum_range argument is optional. If sum_range is omitted, the cells in range are summed instead. Worksheet exampleIn the worksheet shown, there are three SUMIF formulas. In the first formula (G5), SUMIF returns total Sales where Name = "jim". In the second formula (G6), SUMIF returns total Sales where State = "ca" (California). In the third formula (G7), SUMIF returns the total of Sales > 100:
Notice the equals sign (=) is not required when constructing "is equal to" criteria. Also notice SUMIF is not case-sensitive; you can use "jim" or "Jim". Finally, notice that the last formula does not include sum_range, so range is summed instead. Criteria in another cellA value from another cell can be included in criteria using concatenation. In the example below, SUMIF will return the sum of all sales over the value in G4. Notice the greater than operator (>), which is text, must be enclosed in quotes. The formula in G5 is:
Not equal toTo express "not equal to" criteria, use the "<>" operator surrounded by double quotes (""):
Again notice SUMIF is not case-sensitive. Blank cellsSUMIF can calculate sums based on cells that are blank or not blank. In the example below, SUMIF is used to sum the amounts in column C depending on whether column D contains "x" or is empty:
DatesThe best way to use SUMIF with dates is to refer to a valid date in another cell, or use the DATE function. The example below shows both methods:
Notice we must concatenate an operator to the date in E9. To use more advanced date criteria (i.e. all dates in a given month, or all dates between two dates) you'll want to switch to the SUMIFS function, which can handle multiple criteria. WildcardsThe SUMIF function supports wildcards, as seen in the example below:
The tilde (~) is an escape character to allow you to find literal wildcards. For example, to match a literal question mark (?), asterisk(*), or tilde (~), add a tilde in front of the wildcard (i.e. ~?, ~*, ~~). Average range cautionSUMIF makes certain assumptions about the size of sum_range, essentially resizing it when necessary to match the range argument, using the upper left cell in the range as an origin. In some cases, this behavior can create a result that seems reasonable but is in fact incorrect. For an example of this problem, see this article. Which function automatically counts cells that meet multiple conditions?The COUNTIFS function applies criteria to cells across multiple ranges and counts the number of times all criteria are met.
Which of the following functions gives us the summation of cells that meet a set of IE multiple criteria?SUMIFS adds the cells in a range that meet multiple criteria. This is the syntax of the SUMIFS function.
Which of the following functions is best suited to COUNT numbers based on multiple conditions?Excel COUNTIFS function is best suited for situations when you want to count cells based on multiple criteria.
Which of the following functions returns a value if all conditions are met?Logical functions (reference). |