Sub topic 3
SUMIFS: adding values that meet conditions
This chapter assumes you can enter and copy formulas, understand relative and absolute cell references, and know basic SUM. It also assumes your data sits in rows and columns with headers. All examples use the sample sales layout below, with headers in row 1 and data in rows 2 to 100.
A: Date B: Region C: Product D: Amount E: Notes
2025-01-05 West Laptop 1200
2025-01-09 East Monitor 300 Backorder
2025-02-02 West Monitor 310
2025-02-14 North Laptop 1150 GiftThe working model
SUMIFS adds the values in one range, but only for rows where every condition you set is true. The sum range comes first. After it you list one or more pairs, and each pair is a range to test followed by a criterion.
A first formula
To total Amount for the West region:
=SUMIFS(D2:D100, B2:B100, "West")D2:D100 is the range to add. B2:B100 is the range to test. "West" is the criterion. With the sample rows, the result is 1510 (1200 + 310).
Text criteria are not case sensitive, so "west" gives the same result. Put text in quotation marks. Plain numbers do not need them.
Adding a comparison
A comparison operator goes inside a quoted string. To bring in a value from a cell, join it with &. If G1 holds a minimum amount, this adds West rows at or above it:
=SUMIFS(D2:D100, B2:B100, "West", D2:D100, ">=" & G1)Notice that D2:D100 appears twice. It is the sum range, and it is also a test range. That is allowed.
Date ranges
To set both ends of a range, use the same date column in two pairs. This totals all of January 2025:
=SUMIFS(D2:D100, A2:A100, ">=" & DATE(2025,1,1), A2:A100, "<" & DATE(2025,2,1))The end date is exclusive. Using "less than 1 February" includes every moment of 31 January, so no day is missed.
Common errors
- Ranges of different sizes. Every range must have the same number of rows and columns. If one is
B2:B99and the others end at row 100, Excel returns#VALUE!. - The result is 0. No row met all conditions. Look for extra spaces in the data, or numbers stored as text.
- Argument order. Unlike the older SUMIF, SUMIFS puts the sum range first. Copying the order from SUMIF is a frequent mistake.
Exercise
Write a SUMIFS formula that totals Amount for rows where Product is "Laptop" and Region is "North", using the layout in this chapter. What does it return for the four sample rows?
Show answer
=SUMIFS(D2:D100, C2:C100, "Laptop", B2:B100, "North") returns 1150. Only the row dated 2025-02-14 is a North laptop sale.
Exercise
A formula reads =SUMIFS(D2:D100, B2:B99, "West") and returns #VALUE!. What is wrong and how do you fix it?
Show answer
The test range B2:B99 has 98 rows, but the sum range D2:D100 has 99. All ranges must be the same size. Change B2:B99 to B2:B100.