3.2 SUM, SUMIF and SUMIFS
Find the total that belongs to the question
A teammate looking at a fictional Blinkit and Amazon Now order report sees ₹2,870 on a summary line. The next request is “Give me the delivered amount for Pune.” There are four Pune orders. One of them was cancelled. The two totals should disagree because the second question asks Excel to select particular rows before adding their amounts.
Use the ten-row Orders practice sheet in the chapter overview. Every record and amount is made up. The platform labels give you a recognizable context for learning and make no claim about how those companies report sales. In the worksheet, one row is one order. City is C, Amount is G and Status is I, with data on rows 2 through 11. A total remains a rupee amount even after you decide which rows qualify.
Separate the group and the value
- Write the population the question starts with. The whole practice list has ten order rows. Some orders were delivered. Others were cancelled or returned. This controlled group gives you a straightforward total against which to compare the filtered results.
- Write the conditions. The delivered Pune report needs City to equal Pune and Status to equal Delivered. We call each condition a criterion. Both criteria have to pass for the same order row.
- Write the value to combine. Use the number from Amount. A quantity or time can be summed too, but doing so would give a different unit. The same filters can answer multiple questions if you intentionally change the column you add.
Choose SUM, SUMIF or SUMIFS
Use SUM when every numeric value in the reference belongs in the result. =SUM(G2:G11) adds the ten amounts and returns ₹2,870. It is useful as a reference point because it includes the amounts for both successful and unsuccessful orders. Use a label like “All listed amounts” so someone who sees the number understands the limits of the definition.
Use SUMIF to test one condition and add its corresponding values. In =SUMIF(C2:C11,"Pune",G2:G11), read the first range as the cells to test. Pune is the criterion. The final range supplies the amounts. The result is ₹544 because all four Pune rows pass, including the ₹220 cancelled order. The optional final range can be omitted if you test and add the same cells. For example, =SUMIF(G2:G11,">200") tests amounts and adds the matching amounts.
Use SUMIFS when you need one or more conditions and want to give the sum range first. In =SUMIFS(G2:G11,C2:C11,"Pune",I2:I11,"Delivered"), Excel reads the first argument as the values to combine. It then reads each test as a pair: the range to examine and the criterion to apply. It evaluates the city and status positions together. At a position matching both, it adds the corresponding amount. The total is ₹324.
| Function | Reads first | Criteria pairs | Practice result |
|---|---|---|---|
| SUM | Numbers or range to add | None | ₹2,870 across all ten |
| SUMIF | Range to test | One test, then optional sum range | ₹544 for Pune |
| SUMIFS | Range to add | One or more range and criterion pairs | ₹324 for delivered Pune |
Ask one condition in either form
Try =SUMIFS(G2:G11,C2:C11,"Pune"). This gives the same ₹544 as the one-condition SUMIF. Keeping the sum range first can be helpful when you expect to add another condition next week. The one-condition function remains useful when the test and sum use the same field and you want to omit the redundant range. Choose the layout another person can read and maintain.
Check the status branch before trusting an order total
One test fixture row has City Pune and Status Cancelled. If your delivered Pune total includes ₹220 from that row, check whether you added it deliberately. “Pune orders” includes it in this workbook; “Pune delivered” leaves it out. The difference between the totals is a measurement of that condition's effect. This is a better test than checking an arbitrary small number whose source you cannot explain.
Write criteria Excel can evaluate
Conditional formulas accept several forms of criteria. The form affects what Excel compares with each tested cell. Write the intended phrase first and translate the whole phrase into a tested range, a comparison and its value.
- Match a text category. Use
"Pune"to match that city label or"Delivered"to match the status. Double quotation marks tell Excel that these words are literal text. Type straight quotes when entering the expression. - Match a number. If you want orders with a quantity equal to two, use the numeric criterion
2against Qty. Excel reads the exact numeric target without quotation marks. On this worksheet row 2, row 5 and row 10 match that criterion. - Compare against a fixed threshold. Write
">12"for “greater than twelve.” The operator and number are together in one quoted criterion. This excludes exactly twelve. Change the operator to include the boundary when the question says “at least twelve.” - Compare against an editable input. Put 12 in K2. Use
">"&K2for the criterion. The ampersand joins the quoted operator to the value in K2. Writing">K2"would include the letters K2 in the text instead of reading the input cell. - Exclude an exact category. Use
"<>Fruits"to select the other filled categories in this dataset. If new rows can have a missing category, decide how to handle those explicitly. Confirm excluded labels and unknown labels separately.
Build conditional expressions with small test values first. Set the threshold to twelve and use =SUMIF(H2:H11,">"&K2,G2:G11) to total the amounts for orders above it. In the ten records, the five matching rows contribute ₹1,951. Add the Delivered condition with SUMIFS and the total becomes ₹1,731 because row 10 stops contributing ₹220.
You can add a condition on the same column twice. For example, a time band can require a duration of at least twelve and under seventeen minutes. Both comparisons read the H column. The first sets the included lower boundary, and the second sets the excluded upper boundary. Identify in the source which row has seventeen minutes and use it as an explicit boundary test.
Line up references with the same order
Each argument range gives Excel an ordered set of cells. In the first position of the correct formula, the city comes from C2, the status comes from I2, and the amount comes from G2. At the second position, it reads C3, I3 and G3. The formulas do not search an order ID to repair a mismatch. Selecting a range that begins on the wrong row can make the arithmetic operate on values from other orders.
Try a diagnostic comparison in a spare cell. =SUMIFS(G3:G11,C2:C10,"Pune") uses two ranges of nine cells, so they have the same size. The city tests come from rows 2, 4, 7 and 10. When the amount range starts one row later, their matched amount positions read rows 3, 5, 8 and 11. Those amounts add up to ₹1,899. A calculation can produce a precise number for the wrong set of cells. Replacing the ranges with G2:G11 and C2:C11 makes the amount positions line up and returns ₹544.
Place the ranges carefully as you fill a summary
For a city report with one row per city, the input list stays in the same place while the city condition moves down with each summary row. In =SUMIFS($G$2:$G$11,$C$2:$C$11,K5), both source ranges are absolute. K5 is relative. When you fill down to the next result, the source ranges continue to cover the ten original orders and K5 moves to K6. Inspect the filled formula at both ends of the list.
- For SUMIFS. Give the sum range and every criteria range the same dimensions. For this workbook each is a single column of ten entries. Start them on the same record and include the same ordered rows.
- For SUMIF. Give the test and amount ranges the same shape and matching positions. If you supply a differently sized sum range, Excel can use its starting cell and take the test range's shape, as Microsoft's documentation describes. Enter aligned full ranges so a colleague can see the actual intended cells.
- For a growing table. A structured reference such as a table's Amount column follows that table's data rows. Use the City and Status columns from the same table to keep their row membership aligned. Verify a newly entered order actually belongs to the table.
Lab 1 · Reconcile six city totals
Open Orders with all ten original rows from the overview. Keep the scratch report outside columns A through I. Enter a city list in K5 through K10, and label L4 All statuses and M4 Delivered only. These two side-by-side columns are a controlled example of how a second criterion changes the meaning of a number.
| City | All statuses | Delivered only | Difference |
|---|---|---|---|
| Pune | 544 | 324 | 220 |
| Nashik | 360 | 360 | 0 |
| Nagpur | 240 | 0 | 240 |
| Kolhapur | 232 | 232 | 0 |
| Solapur | 1299 | 1299 | 0 |
| Sambhaji Nagar | 195 | 0 | 195 |
- In L5 enter
=SUMIF($C$2:$C$11,K5,$G$2:$G$11). The label in K5 supplies the criterion. The form checks cities and adds the matching amounts with no status restriction. Verify ₹544 before continuing. - In M5 enter
=SUMIFS($G$2:$G$11,$C$2:$C$11,K5,$I$2:$I$11,"Delivered"). This time confirm ₹324. Select the two Pune results and read the starting arguments. Their different positions are the expected function syntax. - Fill L5 through M5 down through row 10. Nashik should give ₹360 in both columns, which confirms the new city label was used and all its rows were delivered. At Nagpur, the all-status column should show 240 and the delivered column should show zero.
- In N5 enter
=L5-M5and fill down to see where the status restriction reduces the total. The nonzero differences identify three cities in this fixture. Read the original Status cells for those records. - At row 11 below your report, add the L results. They total ₹2,870. Then add the M results. They total ₹2,215, which equals
=SUMIF(I2:I11,"Delivered",G2:G11). The differences total ₹655. This reconciliation works because each row has exactly one listed city and every city appears once in the report.
Walk through the city and status tests
Read the city
C2 says Pune. C10 also says Pune. Both records would count in the Pune total if city were the only criterion.
Read the status at that position
I2 says Delivered, so row 2 passes. I10 says Cancelled, so row 10 is dropped from the delivered total.
Collect the amount from each match
G2 supplies 64, G4 supplies 110 and G7 supplies 150. The delivered rows in other cities remain outside this figure.
Verify the difference
Adding the three amounts gives ₹324. Compare with ₹544 for Pune of every status. The missing ₹220 is the cancelled Pune order.
Try removing Nashik from a copy of the city list. The all-status column's sum should drop by ₹360. Try listing Pune twice. Its amount will now be counted twice across the report. Each individual formula can still be correct. The list of summary categories also needs a completeness check.
Lab 2 · Check a three-day report with boundaries
A teammate now asks for amounts recorded on 3, 4 or 5 November 2026. Use the original ten-row Orders fixture in a practice copy. For this exercise, Date represents the day or timestamp recorded for an order. A date must be a usable Excel date value, so verify B before attempting the comparison. When unsure about a typed date, enter it with DATE as shown in the chapter overview.
Use an included start and an excluded next day
- Enter
=DATE(2026,11,3)in K13 and=DATE(2026,11,6)in K14. Label them Start day, included and Next day, excluded. Even if the display uses your local date format, these give the intended date values. - Enter
=SUMIFS($G$2:$G$11,$B$2:$B$11,">="&K13,$B$2:$B$11,"<"&K14)in L13. Excel uses the same date range for both comparisons. The earliest allowed date is 3 November. The date and time must also fall before the start of 6 November. - Expect ₹2,031, from rows 4, 5, 6, 7 and 8. Check that row 9 on 6 November is absent. The pair of tests creates the date interval. It does not select rows by their sheet positions.
- Add a Delivered pair to a copy of the formula:
=SUMIFS($G$2:$G$11,$B$2:$B$11,">="&K13,$B$2:$B$11,"<"&K14,$I$2:$I$11,"Delivered"). The result is ₹1,791. The only order in the interval whose status fails is row 5, so the difference is ₹240. - Add a third conditional result with minutes strictly greater than twelve as a further pair. Rows 4, 6 and 8 are delivered, in the interval and over twelve. Their amounts 110, 232 and 1299 add to ₹1,641. Order matters when you describe the result. Say it is the amount for those eligible orders, measured in rupees.
Make a timestamp expose a common boundary error
In your practice copy only, temporarily change B8 to =DATE(2026,11,5)+TIME(14,30,0). It now represents 5 November at 2:30 p.m. A date-only format could still display the same day. The upper boundary expressed as less than 6 November still includes it, so the all-status total stays at ₹2,031.
In a separate spare cell test a less-than-or-equal-to boundary at DATE(2026,11,5) instead. That value represents the start of 5 November. It excludes the order at 2:30 p.m., even though the cell might display the same calendar date. This alternate result is ₹732. The difference is row 8's ₹1,299. Restore B8 to the original date after confirming the test.
Finally, in K14 move the excluded next day to 7 November and predict the plain date total before reading it. Row 9 on 6 November contributes ₹195. The all-status result increases to ₹2,226. The delivered result remains ₹1,791 because that added row was returned. Restore the original upper boundary before using the course's expected readings again.
Use wildcards and alternatives with a row check
Read a prefix with a wildcard
A wildcard is a sequence in a criterion that can match other characters. In these functions, an asterisk matches a sequence of characters, including none, and a question mark matches one character. =SUMIF(A2:A11,"AMN-*",G2:G11) sums the amounts of the three IDs beginning with AMN and a hyphen. It returns ₹537 from rows 4, 6 and 9. This shortcut tests the ID's prefix. When the official source of platform identity is column D, the platform label is usually a clearer field to test.
In a fictional Swiggy takeaway report, say a text code can literally include an asterisk. The criterion "KITCHEN~*" looks for the literal code KITCHEN followed by an asterisk. Excel treats the tilde as an escape immediately before that wildcard character. Write one known matching and one known nonmatching code in a test copy before applying a broad criterion. A pattern such as "KITCHEN*" would also accept longer suffixes. The wildcard shape must describe the business label you actually want.
Combine alternatives that do not overlap
Multiple criteria in one SUMIFS call are simultaneous. If you put Pune and Nashik as separate exact tests on the same City range, each row would have to be both cities. Here it can have only one. To add Pune or Nashik amounts, add the two separate city totals. The answer is ₹904. Because City contains a single value per row, those two sets are disjoint and no order is added twice.
Handle overlap explicitly
“Pune or Delivered” can match the same order in both groups. Adding the Pune total of 544 and delivered total of 2,215 gives 2,759. This includes the ₹324 for Pune delivered twice. Subtract that intersection once to find the eligible total of ₹2,435. The intersection means the rows that satisfy both conditions. For more complex rules, a helper column that marks the chosen rows once can be easier to inspect. Use the later AND and OR lesson if you need to build such a rule.
Diagnose a sum that looks wrong
When a conditional sum produces zero, Excel might have found no matching rows, or it might have found matches whose amounts add to zero. A matched amount can also be stored as text and fail to contribute as expected. A companion count and a numeric-cell check tell you which route to follow.
- Confirm a matching row exists. Count matches with COUNTIFS using the same mask, or inspect the test fields on a known order. For Nagpur delivered, the matching count is zero in this dataset. That explains the zero amount without requiring a change.
- Check the value type. Try
=ISNUMBER(G2)for the first amount. A visible “64” can still come from pasted text. Verify the type and correct the input in a controlled way before re-running the summary. - Confirm the exact criterion. Inspect a missed label if it has extra whitespace or a different spelling. Reuse a checked criteria cell when a colleague might repeatedly type the same city name.
- Confirm the ranges. Compare first and last addresses and check the formulas on the first and last city rows. A moving source range can drop earlier records as you copy the result.
- Confirm the report definition. Normal SUM and the conditional examples act on the referenced cells even when a sheet filter hides some rows. If the requirement is to total just the currently visible vertical data, test
=SUBTOTAL(109,G2:G11). The 109 variant sums and excludes manually hidden rows along with filtered-out rows. With only delivered rows visible, it should show ₹2,215.
Keep the original source available when testing repairs. Changing a blank or text amount to zero can change the meaning of a financial report. The formula and the definition of each input are both necessary parts of a correct result.
Recognize why a matched group can total zero
When you reconcile money, a zero value can tell three different stories. There may be no matching records. A matched group may add to exactly zero. A nonnumeric value can also leave a total short. Distinguish these cases before concluding that no activity occurred.
For a small separate exercise, use a fictional Swiggy restaurant partner record of daily adjustments. The data is invented. Put Reference, Store and Adjustment in A1 through C1 on a scratch sheet. An adjustment here is signed, which means a positive value increases the recorded amount and a negative value reduces it. These are example corrections rather than business accounting advice.
| Ref | Store | Entered adjustment |
|---|---|---|
| SW-101 | West | 120 |
| SW-102 | West | -120 |
| SW-103 | South | 110 |
| SW-104 | South | 90 as text |
- Use
=SUMIF(B2:B5,"West",C2:C5)and=COUNTIF(B2:B5,"West"). The amount is zero and the record count is two. Inspect the signs. The positive and negative values are equal and cancel each other. - Use the same two tests for North. The amount is zero again, and the record count is zero. The inputs contain no matching North records. A report with both fields gives the reader more information than a report with only the amount.
- Run the sum and count for South. The record count is two, while the total is 110 with C5 entered as text.
=ISNUMBER(C5)returns FALSE. Investigate the source type before deciding whether 90 belongs in the sum. - Re-enter C5 as a clean numeric 90 in this controlled exercise. The South record count stays at two, and the sum rises to 200. Restore the text version if you want someone else to repeat the exact diagnostic experiment.
- Check a separate plain total. With C5 numeric it is 200 because both West adjustments cancel. This confirms your city formulas agree with the overall signed amount once all numeric input is available.
If a real export intentionally uses a field such as “Pending,” agree on how to report it before converting values. A text status can express a valid business state that has no amount yet. Move descriptive states to a status field when you control the worksheet design. A sum over signed numbers and a count of incomplete records answer distinct questions.
Check the analysis with four changes to the report
Use a fresh copy of the ten-row Orders worksheet and try these variations after the labs. Write the matched row numbers before entering each formula. A good result includes the number and a reason it covers the right inputs.
- Sum the amount field itself above a threshold. Use
=SUMIF(G2:G11,">200")to total amounts strictly above ₹200. The result is ₹2,261 from rows 3, 5, 6, 8 and 10. With the sum range omitted, the function adds the values it tested. Adding a matching G range explicitly would give the same result. - Use the same date interval with a different measure. In the date calculation, switch the first range from Amount to Qty, keeping the date criteria unchanged. Rows 4 through 8 contribute quantities 1, 2, 4, 5 and 1. Their quantity total is thirteen. Re-label the result in units so it is not read as ₹13.
- Test a time band. Add amounts for durations of at least twelve and less than seventeen minutes. For all statuses, rows 3, 4, 6 and 10 sum to ₹832. Seventeen on row 11 fails the upper test. Twelve on row 3 passes the lower one.
- Reconcile a category complement. Fruits orders total ₹600. All other filled categories on the original sheet add to ₹2,270. They sum to the original gross of ₹2,870. If you add a blank category to a working report, verify whether your policy treats it as other, unknown, or excluded from this view.
Make the summary safe to change next week
When the city report grows from a quick check into something a teammate opens every week, move the decisions they need to change into labeled cells. A threshold in K2 is already useful. A summary status can become another input, and the report title can say exactly which city and status are in scope. Make this move in a copy and verify that the original scenario produces exactly the same values after you change the formula.
Separate the criteria cells from the source columns
In the city report, type Delivered in P2 and use a separate header to describe it as Selected status. In M5 replace the fixed text criterion with $P$2. Keep the city condition relative to the city list and the source ranges fixed. Fill that version down again. The delivered-only total should still be ₹2,215. Rename the results heading to Selected status amount, because the output now changes when P2 changes.
- Change P2 to Cancelled. Pune now shows 220 and Nagpur shows 240. All other city amounts are zero in the selected status column. The total for this condition is ₹460. The all-status totals remain unchanged.
- Change P2 to Returned. Sambhaji Nagar contributes ₹195, and the other city rows contribute zero. Restore Delivered and confirm the original amount. A changing input is easy to verify when its possible matches give visibly different group results.
- Decide how the report treats an empty status input before sharing it. A blank criterion reference has its own Excel behavior and might lead to a zero result. For a beginner worksheet, keep the status control filled with an allowed label and document the allowed options next to it.
- On a copy, put the report on a separate worksheet. Add the Orders sheet prefix to each source range, while keeping the city and status criteria on the report sheet. Recheck a single known city before filling. Identical coordinate letters on another tab can otherwise point to an entirely different dataset.
Reconcile across statuses before choosing a new total
In this dataset, every order has one of exactly three recorded statuses. The Delivered, Cancelled and Returned amounts therefore partition the gross. Partition means each record belongs to one group, and the groups together cover the entire dataset. Verify the arithmetic as 2,215 plus 460 plus 195, which returns 2,870. When a new status is introduced or a cell is left blank, the three hard-coded groups may no longer cover every row. Check the categories and numeric records, even when the first few summary lines still look familiar.
A daily report often has a second time boundary such as the period ending yesterday. Put that boundary on the report with a date and a short explanation of what is included. Avoid modifying the raw date column to produce the desired total. This allows two reports to use the same source with different, visible filters. For a handoff test, pick a known returned row and trace it through the city, date and status fields. Let the next reviewer change just one condition and predict whether that row contributes.
Quiz · trace the qualifying amounts
For Pune delivered, how much comes from the cancelled Pune order?
None of its ₹220 belongs in the delivered result. It helps explain the difference between the Pune total across all statuses and the delivered-only total.
Which range does SUMIFS read first?
It reads the values to add first. The remaining arguments are range-and-criterion pairs. SUMIF takes the tested range first and can take a separate sum range as its final argument.
If K2 contains 12, which criterion reads it dynamically?
Use ">"&K2. The greater-than character is literal and the address remains outside the quotes, so Excel can read the number in K2. Typing the whole criterion as quoted letters would omit that lookup.
What does “less than 6 November” include when combined with “at least 3 November”?
It includes 3 through 5 November, including a timestamp at 2:30 p.m. on 5 November. The upper boundary excludes the moment 6 November starts and any time after it.
Why do two equal-length ranges sometimes return the wrong sum?
Excel matches positions in those ranges. If the amount range starts on the next row, the position for a city's match picks up another order's amount. Verify the record boundaries as well as the number of rows.
Can you add the Pune sum and the delivered sum to answer “Pune or Delivered”?
Only if you correct for the overlap. The Pune delivered rows are counted twice in that addition. Subtract the intersection once, or mark each eligible row with a single flag and sum it once.
Interview practice · show your verification
How would you explain SUMIF and SUMIFS to a colleague?
I would use one known city sum as the first exercise. SUMIF tests one field and can add amounts from another. SUMIFS places the sum field first, then accepts all the necessary conditions as pairs. I would use a cancelled Pune row to make the second condition's effect visible.
How do you keep a summary correct when filling it down?
I would lock the source addresses and allow the summary's criterion reference to advance. In the six-city lab, the same amount and city ranges remain fixed as K5 becomes K6. I would inspect a filled formula and independently recalculate its city total.
What is a good way to test date-based totals?
I would check one value at the start, one late on the final day and one at the start of the next day. An excluded upper boundary at the next day catches time values inside the final day. Each boundary example should have an amount I can trace back to its row.
What can you infer from a conditional total of zero?
It tells me the sum returned zero. I also need the matching count and the source value types. A signed group can cancel to zero, so I would inspect at least one known matching row before changing the formula or calling the group empty.
How would you handle a workbook where the visible total disagrees with a formula?
I would ask whether the report should obey the current sheet filter or a fixed logical criterion. Then I would compare the ranges and count a few included records. SUBTOTAL can respond to hidden and filtered rows, while the ordinary formulas in this lesson use the referenced rows.
Six cards to keep each argument straight
- SUM Add numeric values across a stated reference. Give the result a clear label and unit.
- SUMIF Test a range against one criterion. The final argument can supply a different range to add.
- SUMIFS Place the sum range first. Each subsequent range and criterion pair adds a required condition.
- Alignment Matching dimensions are necessary. Make sure the same position refers to the same record in every range.
- Criteria value Quote literal comparison text. Combine a quoted operator with an unquoted cell address to read a changing threshold.
- Reconciliation Verify which rows passed. An empty group, a balanced group and a missing numeric input all deserve their own checks.
Continue with the COUNT family lesson. The shorter SUMIF and SUMIFS guide is useful for reviewing the argument order. The existing printable cards cover plain sums, one criterion and multiple criteria. Their practice rows can use different labels.
Microsoft references
Continue practising: explore the existing Excel Task Hub for additional exercises.