Use the SUMIF function to add numbers in a specific range only if they meet a single condition, such as a specific text, date, or number. This is a quick way to filter data while totaling it without using a separate filtering tool or pivot table.

What You'll Need

  • Microsoft Excel installed on your computer (versions 2010 or later, including Excel for the Web and Excel for Mac).
  • A worksheet containing numerical data in one column or row and corresponding data in another column or row.
  • Basic familiarity with selecting cells and typing text into them.

Step-by-Step

  1. Select the cell where you want the result to appear. Click on the empty cell in your spreadsheet where you want the sum of the specified items to be displayed. This is often at the bottom of a column or to the right of a set of data.
  2. Open the formula bar. Click on the formula bar near the top of the Excel window. It is the box to the left of the fx symbol. Alternatively, you can simply start typing a formula directly into the selected cell.
  3. Type the SUMIF function. Begin typing the function name: SUMIF. Excel will often suggest the function name as you type; you can press Tab to select it automatically.
  4. Define the range argument. The first argument of SUMIF is the range where the condition will be checked. Click and drag your mouse to select the cells that contain the data you want to evaluate against the condition. For example, if you have a list of fruit names in column A and their prices in column B, select column A to check for the fruit name.
  5. Enter the criteria. After the comma that separates the range from the criteria, type the value you are looking for. This can be a number (e.g., >100), a date (e.g., "2023-01-01"), or text in quotation marks (e.g., "Apple"). Ensure text is enclosed in double quotes.
  6. Define the sum range. The third argument is the range of cells to add up. This can be the same as the range selected in step 4 if you want to sum the same cells you are checking, or a different range. If you selected column A in step 4, you might select column B here to sum the prices. If you omit this argument, Excel will sum the first range you selected.
  7. Close the parentheses. Type a closing parenthesis ) to complete the function structure.
  8. Press Enter. Press the Enter key on your keyboard to finish the calculation. The cell will now display the total sum of the values that met your specified condition.

Common Mistakes

One of the most frequent errors when using SUMIF is confusing the order of the arguments. The syntax is SUMIF(range, criteria, [sum_range]). If you accidentally put the sum range first, Excel will try to check if the numbers in the price column match your text criteria, which will result in a #VALUE! error. Always ensure the range containing the condition comes before the comma, and the range containing the numbers to add comes after.

Another common issue arises when the criteria is text. Users often forget to enclose text in quotation marks. If you type Apple instead of "Apple", Excel will interpret it as a cell reference (attempting to find a cell named Apple) rather than the word Apple itself. Similarly, using strict equality operators like = is unnecessary for text; simply typing the word is sufficient.

Users also frequently make the mistake of including the header row in their range selection. If your data starts in row 2, always select down to the last row of data, not including the header in row 1. If you include the header, Excel may attempt to sum the text label, leading to a #VALUE! error.

Tips

You can use wildcard characters in the criteria argument to make your SUMIF formulas more flexible. The asterisk * matches any sequence of characters, and the question mark ? matches any single character. For example, if you have a list of different fruit types and want to sum all items that contain the word “berry”, you can use the criteria "*berry*". This will match “Strawberry”, “Blueberry”, and “Raspberry”.

When working with dates, it is best practice to reference a specific cell containing the date rather than typing the date directly into the formula, especially if the cell format is set to “Text”. However, if you do type the date directly, ensure it is enclosed in quotation marks, such as "12/31/2023", to avoid confusion with Excel's date calculations.

Be aware of the difference between SUMIF and SUMIFS. SUMIF can only handle a single condition. If you need to sum numbers based on multiple conditions (for example, sum sales for a specific product in a specific region), you must use the SUMIFS function, which allows you to list multiple range-criteria pairs.

When the ranges for the condition and the sum are not adjacent, ensure you have correctly identified which column is which. A visual check of your selected ranges before pressing Enter is a quick way to catch mismatches.

Troubleshooting

If the result in your cell is #VALUE!, first check if your criteria text is missing quotation marks. Next, verify that the ranges you selected are strictly comparable. For instance, you cannot use SUMIF to add numbers in one column and check a text condition in another column unless the text condition is in a separate column. If you are summing numbers and checking numbers, ensure there are no leading spaces or text formatting that might be preventing an exact match.

If the result is #NAME?, check your spelling. Ensure you typed SUMIF correctly and that your Excel version supports this function (all modern versions do). If you are using Excel for the Web or a very old version, the function name might be slightly different or the feature might not be available.

If the result is zero or incorrect, verify that your criteria matches the data exactly. Text matching in Excel is case-sensitive, so “Apple” and “apple” are treated as different values. Also, check if you accidentally included the header row in your range, which can cause the formula to look for a header that does not match your criteria.

If you are using a text criteria and it is not matching, look for hidden characters. Sometimes data imported from other sources can have invisible spaces or non-breaking spaces that break the match. You can use the TRIM() function on your criteria text or the data source to remove these spaces.

Frequently Asked Questions

Can I use SUMIF to sum cells based on the color of the text or font?

No, standard SUMIF cannot evaluate cell formatting like font color. You must use conditional formatting rules combined with the SUM function and the SUBTOTAL or GET.CELL functions, or use a filter to manually hide non-matching cells before summing.

What is the difference between SUMIF and SUMIFS?

SUMIF allows you to add numbers based on only one condition. SUMIFS allows you to add numbers based on multiple conditions. The order of the arguments is also different: in SUMIF, the sum range is the third argument, while in SUMIFS, the sum range is the first argument.

Why does my SUMIF formula return a result of zero?

This usually means no cells in the specified range met the criteria. Check your criteria to ensure it matches the data exactly, paying attention to case sensitivity and extra spaces. Also, ensure the range you are summing contains numbers, not text.

Can I use a date as a criterion in SUMIF?

Yes, you can. You can type the date directly into the formula enclosed in quotation marks (e.g., "2023-10-25") or reference a cell that contains the date. You can also use comparison operators like > or < with dates.

How do I sum values greater than a certain number?

Use the greater than operator > in your criteria argument. For example, to sum all values greater than 100, you would write SUMIF(A1:A10, ">100", B1:B10).

Does the order of arguments in SUMIF matter?

Yes. The syntax is SUMIF(range, criteria, [sum_range]). The range (where the condition is checked) is second, and the sum range (where the numbers are added) is third. If you put the sum range first, Excel will look for the condition in the numbers, which will likely cause an error.