Using SUMIF and SUMIFS for Conditional Calculations in Excel
Course: Advanced Excel Training
Topic: Using SUMIF and SUMIFS for Conditional Calculations
Course Link: Advanced Excel Course – JustAcademy
Demo Link: Register for a Course Demo
Website: JustAcademy Official Website
1. Introduction to Conditional Calculations in Excel
Conditional calculations in Microsoft Excel allow users to calculate totals based on specific conditions. Instead of adding every value in a dataset, you can use functions such as SUMIF and SUMIFS to sum only the values that meet particular criteria.
These functions are widely used in sales reports, financial analysis, inventory management, expense tracking, employee reporting, budgeting, and business dashboards.
For example, if a worksheet contains sales information for multiple products and regions, you can calculate the total sales for a specific product using SUMIF or calculate sales for a specific product in a particular region using SUMIFS.
Learning Objectives
- Understand conditional summation in Excel.
- Learn the syntax and arguments of SUMIF and SUMIFS.
- Apply single-condition and multiple-condition calculations.
- Use text, numeric, date, and cell-reference criteria.
- Understand comparison operators and wildcard characters.
- Identify and troubleshoot common formula errors.
- Apply SUMIF and SUMIFS to practical business scenarios.
2. Understanding the SUMIF Function
The SUMIF function adds values in a specified range when the corresponding cells satisfy one condition. It is useful when you need to calculate a total based on a single criterion.
Syntax
=SUMIF(range, criteria, [sum_range])
Arguments Explained
| Argument |
Description |
Example |
| range |
The cells Excel checks against the condition. |
A2:A10 |
| criteria |
The condition that determines which cells qualify. |
"Laptop" |
| sum_range |
The cells containing values to add. This argument is optional. |
C2:C10 |
If sum_range is omitted, Excel sums the cells in the range argument that satisfy the criteria.
Example Dataset
| Product |
Region |
Sales |
| Laptop |
North |
50000 |
| Mobile |
South |
20000 |
| Laptop |
West |
45000 |
| Tablet |
North |
15000 |
| Laptop |
South |
35000 |
| Mobile |
West |
25000 |
Assume the data is stored in cells A2:C7, where column A contains products, column B contains regions, and column C contains sales amounts.
Example 1: Calculate Total Sales for Laptops
=SUMIF(A2:A7,"Laptop",C2:C7)
Explanation:
- A2:A7 is the range containing product names.
- "Laptop" is the condition.
- C2:C7 is the range containing sales values.
Result: 130000
Excel adds 50000, 45000, and 35000 because these amounts belong to rows where the product is Laptop.
Example 2: Calculate Sales for a Specific Product Using a Cell Reference
Suppose cell E2 contains the product name Laptop.
=SUMIF(A2:A7,E2,C2:C7)
This formula uses the value in E2 as the condition. If you change E2 to Mobile, the formula calculates the total sales for Mobile instead.
Using cell references makes formulas easier to reuse in reports and dashboards.
3. Understanding the SUMIFS Function
The SUMIFS function adds values only when multiple conditions are satisfied. It is particularly useful when a calculation depends on more than one requirement.
For example, a sales manager may want to calculate Laptop sales in the North region, or an accountant may want to total expenses for a particular department during a specified period.
Syntax
=SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)
Arguments Explained
| Argument |
Description |
Example |
| sum_range |
The cells containing the values to add. |
C2:C7 |
| criteria_range1 |
The first range to evaluate. |
A2:A7 |
| criteria1 |
The first condition. |
"Laptop" |
| criteria_range2 |
An additional range to evaluate. |
B2:B7 |
| criteria2 |
An additional condition. |
"North" |
Important: SUMIFS uses the sum range first, whereas SUMIF places the criteria range first. Mixing up these argument positions is a common source of formula errors.
Example 1: Calculate Laptop Sales in the North Region
=SUMIFS(C2:C7,A2:A7,"Laptop",B2:B7,"North")
Explanation: Excel checks the product column for Laptop and the region column for North. It adds sales only when both conditions are true.
Result: 50000
Example 2: Calculate Laptop Sales in the South Region
=SUMIFS(C2:C7,A2:A7,"Laptop",B2:B7,"South")
Result: 35000
Example 3: Use Cell References for Multiple Conditions
Suppose E2 contains Laptop and F2 contains North.
=SUMIFS(C2:C7,A2:A7,E2,B2:B7,F2)
The formula returns 50000. You can change either cell to calculate different product and region combinations without editing the formula itself.
4. Difference Between SUMIF and SUMIFS
| Feature |
SUMIF |
SUMIFS |
| Purpose |
Conditional summation using one condition |
Conditional summation using multiple conditions |
| Number of criteria |
One criterion |
One or more criteria |
| Argument order |
Range, criteria, sum_range |
Sum_range, criteria_range1, criteria1, etc. |
| Typical use |
Total sales for one product |
Total sales for a product in a specific region |
| Criteria logic |
One condition |
Conditions are generally combined using AND logic |
| Flexibility |
Best for straightforward calculations |
Best for detailed reports and multi-condition analysis |
Note: SUMIFS supports multiple criteria ranges. Each criteria range must be compatible in size and shape with the sum range. When several conditions are supplied, a row must satisfy all of them to contribute to the total.
5. Using Comparison Operators in SUMIF and SUMIFS
Comparison operators let you create conditions based on numeric values, dates, or text comparisons.
| Operator |
Meaning |
Example Criterion |
| = |
Equal to |
"=Laptop" |
| > |
Greater than |
">10000" |
| < |
Less than |
"<5000" |
| >= |
Greater than or equal to |
">=5000" |
| <= |
Less than or equal to |
"<=10000" |
| <> |
Not equal to |
"<>Laptop" |
Example 1: Sum Sales Greater Than 30000
=SUMIF(C2:C7,">30000",C2:C7)
Result: 130000
This formula adds sales amounts greater than 30000: 50000, 45000, and 35000.
Example 2: Sum Sales Less Than 30000
=SUMIF(C2:C7,"<30000",C2:C7)
Result: 60000
The qualifying values are 20000, 15000, and 25000.
Example 3: Use a Comparison Operator with a Cell Reference
If cell E2 contains the threshold amount, use:
=SUMIF(C2:C7,">"&E2,C2:C7)
The ampersand (&) joins the comparison operator with the value in E2. If E2 contains 30000, Excel sums values greater than 30000.
Example 4: SUMIFS with Multiple Numeric Conditions
Suppose sales values are in C2:C7 and product names are in A2:A7.
=SUMIFS(C2:C7,A2:A7,"Laptop",C2:C7,">40000")
This formula adds Laptop sales only when the sales amount is greater than 40000.
Result: 95000
6. Using SUMIF and SUMIFS with Dates
Dates are frequently used as criteria in financial reporting, monthly sales analysis, attendance summaries, and expense tracking. Excel stores dates as serial numbers, so criteria can compare dates using operators.
Example Dataset
| Date |
Department |
Expense |
| 01-Jan-2026 |
Marketing |
5000 |
| 05-Jan-2026 |
IT |
8000 |
| 15-Jan-2026 |
Marketing |
7000 |
| 02-Feb-2026 |
Marketing |
6000 |
| 10-Feb-2026 |
IT |
9000 |
Assume dates are in A2:A6, departments in B2:B6, and expenses in C2:C6.
Example 1: Total Expenses After 10 January 2026
=SUMIF(A2:A6,">"&DATE(2026,1,10),C2:C6)
Result: 22000
The formula includes expenses dated after 10 January 2026.
Example 2: Total Marketing Expenses in January 2026
=SUMIFS(C2:C6,B2:B6,"Marketing",A2:A6,">="&DATE(2026,1,1),A2:A6,"<"&DATE(2026,2,1))
Result: 12000
This formula checks three conditions: the department must be Marketing, the date must be on or after 1 January 2026, and the date must be before 1 February 2026.
Using a less-than condition for the first day of the next month is a reliable way to capture an entire month, including dates that may contain time values.
7. Using Wildcards with SUMIF and SUMIFS
Wildcards are useful when you want to match text patterns rather than an exact text value.
| Wildcard |
Meaning |
Example |
| * |
Any number of characters |
"Lap*" |
| ? |
Exactly one character |
"P?n" |
| ~ |
Escapes a wildcard so it can be matched literally |
"~*Sale" |
Example 1: Sum Sales for Product Names Starting with Lap
=SUMIF(A2:A7,"Lap*",C2:C7)
This formula sums sales for product names that begin with Lap, such as Laptop and Laptop Pro.
Example 2: Sum Sales for Product Names Containing the Word Phone
=SUMIF(A2:A7,"*Phone*",C2:C7)
The asterisk before and after Phone allows any characters to appear before or after that text.
Example 3: Combine Wildcards with SUMIFS
=SUMIFS(C2:C7,A2:A7,"Lap*",B2:B7,"North")
This formula sums sales for products whose names begin with Lap in the North region.
8. Practical Business Applications
8.1 Sales Analysis
Sales teams can calculate revenue for a particular product, salesperson, territory, or period.
=SUMIF(B2:B100,"North",D2:D100)
This formula calculates the total sales recorded for the North region, assuming column B contains regions and column D contains sales amounts.
8.2 Department-Wise Expense Reporting
=SUMIF(A2:A100,"IT",C2:C100)
This formula adds expenses for the IT department.
8.3 Monthly Sales Reporting
=SUMIFS(D2:D100,A2:A100,">="&DATE(2026,1,1),A2:A100,"<"&DATE(2026,2,1))
This formula calculates sales recorded during January 2026, assuming column A contains dates and column D contains sales amounts.
8.4 Inventory Management
=SUMIF(A2:A100,"Electronics",C2:C100)
This formula calculates the total inventory quantity or another numeric measure for Electronics, depending on what column C represents.
8.5 Employee Bonus Calculations
=SUMIFS(D2:D100,B2:B100,"Sales",C2:C100,">=50000")
This formula totals values in column D for employees in the Sales department whose values in column C are at least 50000. The exact business meaning depends on the worksheet structure.
9. Combining SUMIF and SUMIFS with Other Excel Functions
Combining conditional summation with other functions helps create more flexible and readable spreadsheets.
9.1 Using SUMIFS with IFERROR
=IFERROR(SUMIFS(C2:C100,A2:A100,E2,B2:B100,F2),0)
This formula returns the SUMIFS result or zero if the calculation produces an error. Use IFERROR thoughtfully because it can also hide genuine formula problems.
9.2 Using SUMIFS with a Dropdown List
You can create a dropdown list for product or region selection using Data Validation. Reference the selected values in the SUMIFS formula.
=SUMIFS(C2:C100,A2:A100,E2,B2:B100,F2)
When the user selects a different product in E2 or region in F2, the total updates automatically.
9.3 Using SUMIF with Named Ranges
Named ranges make formulas easier to read and maintain. Suppose the product range is named Products and the sales range is named SalesAmounts.
=SUMIF(Products,"Laptop",SalesAmounts)
To create named ranges, select the cells and use the Name Box or choose Formulas > Define Name.
10. Common Errors and Troubleshooting
| Problem |
Possible Cause |
Solution |
| Incorrect total |
Wrong range or criteria |
Check the criteria and sum ranges carefully. |
| Zero result |
No matching records or mismatched text |
Verify spelling, spaces, data types, and the condition. |
| #VALUE! error |
Incompatible range sizes or problematic references |
Ensure criteria ranges and the sum range have compatible dimensions. |
| Dates are excluded |
Dates stored as text or incorrect boundaries |
Convert text dates to real Excel dates and check date criteria. |
| Formula changes unexpectedly |
Relative references shift when copied |
Use absolute references such as $A$2:$A$100 where needed. |
| SUMIFS returns an unexpected total |
Conditions are combined using AND logic |
Confirm every criterion should be satisfied on the same row. |
| Numbers are not included |
Numbers stored as text |
Convert text-formatted numbers to numeric values. |
Best Practices for Troubleshooting
- Check that every criteria range aligns with the sum range.
- Use consistent data types for dates, text, and numbers.
- Use cell references instead of repeatedly typing criteria.
- Use absolute references when copying formulas across cells.
- Test complex formulas with a small dataset before applying them to a large report.
- Use Excel's Evaluate Formula feature to inspect formula calculations step by step.
- Check for leading or trailing spaces in imported text data.
11. Advanced Tips for Accurate Conditional Calculations
11.1 Adding Multiple Criteria
SUMIFS can evaluate several conditions in one formula.
=SUMIFS(D2:D100,A2:A100,"Laptop",B2:B100,"North",C2:C100,">=10000")
The formula adds values from column D only when the product is Laptop, the region is North, and the value in column C is at least 10000.
11.2 Summing Based on Multiple Alternative Values
SUMIFS uses AND logic across criteria pairs. If you need an OR condition, such as summing sales for either Laptop or Mobile, you can add separate SUMIF formulas.
=SUMIF(A2:A100,"Laptop",C2:C100)+SUMIF(A2:A100,"Mobile",C2:C100)
This formula calculates the combined sales for Laptop and Mobile products.
11.3 Using Criteria from a Cell
=SUMIF(A2:A100,E2,C2:C100)
Keep criteria in dedicated cells when building interactive reports. This allows users to change conditions without editing the formulas.
11.4 Using Excel Tables
Convert a dataset into an Excel Table using Ctrl+T. Structured references can make formulas easier to maintain as new rows are added.
For a table named SalesData with columns Product and Sales, use:
=SUMIF(SalesData[Product],"Laptop",SalesData[Sales])
Excel Tables automatically expand when new rows are added, helping formulas remain aligned with the dataset.
12. Hands-On Practice Exercises
Use the following dataset to practise SUMIF and SUMIFS.
| Employee |
Department |
Region |
Sales |
| Amit |
Sales |
North |
40000 |
| Priya |
Marketing |
South |
25000 |
| Rahul |
Sales |
West |
55000 |
| Neha |
Sales |
North |
30000 |
| Arjun |
Marketing |
West |
35000 |
| Sneha |
Sales |
South |
45000 |
Assume the dataset occupies cells A2:D7.
Exercise 1: Total Sales for the Sales Department
=SUMIF(B2:B7,"Sales",D2:D7)
Expected Result: 170000
Exercise 2: Total Sales in the North Region
=SUMIF(C2:C7,"North",D2:D7)
Expected Result: 70000
Exercise 3: Total Sales for the Sales Department in the North Region
=SUMIFS(D2:D7,B2:B7,"Sales",C2:C7,"North")
Expected Result: 70000
Exercise 4: Total Sales Greater Than 40000
=SUMIF(D2:D7,">40000",D2:D7)
Expected Result: 100000
Exercise 5: Total Marketing Sales in the West Region
=SUMIFS(D2:D7,B2:B7,"Marketing",C2:C7,"West")
Expected Result: 35000
Exercise 6: Calculate Sales Based on Cell References
Enter Sales in F2 and North in G2, then calculate the matching total.
=SUMIFS(D2:D7,B2:B7,F2,C2:C7,G2)
Expected Result: 70000
13. Mini Project: Create a Conditional Sales Summary Report
Project Objective: Build a simple Excel report that allows a user to summarize sales by department and region.
Project Requirements
- Create a worksheet containing employee, department, region, date, and sales information.
- Format the dataset as an Excel Table.
- Create dropdown lists for department and region selection.
- Use SUMIF to calculate totals based on one selected criterion.
- Use SUMIFS to calculate totals based on department, region, and date.
- Add headings, currency formatting, and a clear report layout.
- Test the report with different selections and validate the totals against the source data.
Sample Report Formula
=SUMIFS(D2:D100,B2:B100,F2,C2:C100,G2,A2:A100,">="&H2,A2:A100,"<"&I2)
In this example, column A contains dates, column B departments, column C regions, and column D sales. Cells F2 and G2 contain the selected department and region, while H2 and I2 contain the start date and exclusive end date.
The formula sums sales for the selected department and region within the specified date interval. For example, to include all of January, set H2 to 1 January and I2 to 1 February of the same year.
Project Deliverables
- A clean, structured source dataset.
- A conditional sales summary using SUMIF.
- A multi-condition report using SUMIFS.
- Dropdown-based filtering controls.
- A validation section confirming the calculated totals.
14. Interview Questions and Answers
Q1. What is the SUMIF function in Excel?
Answer: SUMIF adds values that satisfy one specified condition, such as calculating sales for a particular product.
Q2. What is the SUMIFS function?
Answer: SUMIFS adds values that satisfy multiple conditions, such as calculating sales for a product in a specific region during a given month.
Q3. What is the main difference between SUMIF and SUMIFS?
Answer: SUMIF is designed for a single criterion, while SUMIFS supports multiple criteria. Their argument order is also different.
Q4. Can SUMIFS handle more than two conditions?
Answer: Yes. You can add multiple criteria-range and criteria pairs to filter the values being summed.
Q5. How do you use greater-than or less-than conditions?
Answer: Put the comparison operator inside quotation marks, such as ">1000" or "<5000". When referencing a cell, concatenate the operator with the cell reference, for example, ">"&E2.
Q6. Can SUMIF work with text criteria?
Answer: Yes. You can use exact text criteria such as "Laptop" or wildcard patterns such as "Lap*".
Q7. How can you sum values between two dates?
Answer: Use SUMIFS with a start-date condition and an exclusive end-date condition. For a complete month, use the first day of the month and the first day of the next month.
Q8. Why might SUMIFS return zero?
Answer: The criteria may not match the dataset, dates may be stored as text, ranges may be incorrect, or no row may satisfy all conditions.
Q9. Does SUMIFS use AND or OR logic?
Answer: Criteria pairs in a single SUMIFS formula generally use AND logic. To calculate an OR condition, you can add separate SUMIF or SUMIFS formulas, taking care not to double-count overlapping records.
Q10. Can SUMIF and SUMIFS work with Excel Tables?
Answer: Yes. Structured references such as SalesData[Sales] and SalesData[Product] can make formulas easier to understand and maintain.
15. Quick Revision Checklist
- SUMIF calculates totals using one condition.
- SUMIFS calculates totals using multiple conditions.
- SUMIF syntax:
=SUMIF(range,criteria,sum_range).
- SUMIFS syntax:
=SUMIFS(sum_range,criteria_range1,criteria1,...).
- SUMIF and SUMIFS support text, numeric, and date-based conditions.
- Wildcard characters help match partial text.
- Use cell references to make formulas reusable.
- Use consistent range dimensions to avoid incorrect calculations.
- Use separate formulas when you need OR logic.
- Validate formula results against the original dataset.
16. Conclusion
SUMIF and SUMIFS are essential Excel functions for performing conditional calculations efficiently. SUMIF is suitable for straightforward calculations involving one criterion, while SUMIFS is ideal for more detailed analysis involving multiple conditions.
By practising these functions with text, numbers, dates, wildcards, cell references, and Excel Tables, learners can create accurate sales reports, expense summaries, inventory calculations, and business dashboards. Understanding the differences between the two functions also helps reduce formula errors and improves spreadsheet reliability.
For further learning, explore the Advanced Excel Training Course at JustAcademy and register for a course demo.
Visit the JustAcademy website to explore additional training resources.