Excel not in sumif в excel

The SUMIF function is a useful function when it comes to summing up values based on some given condition. But there are times when you will face some difficulties working with the function. You will notice that the SUMIF function is not working properly or returning inaccurate results. This mostly happens when you are new t0 this function and haven’t used it enough. It doesn’t mean that it can’t happen to experienced Excel players. Excel surprises us with its secrets.

There can be many reasons behind SUMIF’s inaccuracy. In this article we will discuss all the cases in which SUMIF function may not work and how you can get it working.

Before we discuss issue points with SUMIF function in detail, check these in your formula. You may get your SUMIF formula working.

  • If SUMIF is returning #N/A error or any other error, evaluate the formula. There is 80% chance that you will get your formula working. To evaluate formula, select the formula cell and go to Formula tab in ribbon. Here find Evaluate Formula option. You will find it in Auditing section.
  • If you are writing the correct formula and when you update sheet, the SUMIF function doesn’t return updated value. It is possible that you have set formula calculation to manual. Press F9 key to recalculate the sheet.
  • Check the format of the values involved in the calculation. It is very likely to have unexpected formats if you have imported data from other sources.

Now, if those haven’t helped, you will get the SUMIF function working using below methods.

1. SUMIF Isn’t Working- Syntax Error

Syntactical error  is pretty  common mistake among the new users. Even Experienced users can make syntactical error while using the SUMIF function. So first let’s see the syntax of SUMIF function.

Generic Excel SUMIF Formula:

=SUMIF(condition_range,condition,sum range)

You can learn all about SUMIF function here.

So the first argument is a range that contains your condition. The condition will be checked in this range only.

The second argument is condition itself. This is the condition that you want to check in the condition_range.

sum_range: The it is the range in that you want to some.

So we had a quick summery of the SUMIF function. Now let’s see what syntactical mistakes you can do while using the SUMIF function.

Defining Criteria Mistakes

Most of the mistakes are done when we define criteria. It is due to the variation of data. The criteria in SUMIF is defined differently in different scenarios. To understand it, let’s see some example.

Here I have a data set.

Let’s say I need to sum quantity of date 1-Mar-13.
So we write this formula.

=SUMIF(A2:A20,1-mar-13,C2:C20)

Will it work? Correct! this SUMIF formula will not work. It will return 0. Why?

The data we are working with is formatted as date. And dates in Excel are actually a numbers. And n number can be written without quotes as criteria. But still excel does not return the correct answer.

Actually, in SUMIF in excel, accepts date as text in criteria (if not formatted as serial number). So if you write this formula, it will return the correct answer.

=SUMIF(A2:A20,»1-mar-13″,C2:C20)

ort

=SUMIF(A2:A20,»1-mar-2013″,C2:C20)

The number equivalent of 1-mar-13 is 41334. So if I write this formula, it will return the correct answer.

=SUMIF(A2:A20,41334,C2:C20)

Note that I didn’t use any quotes in this case. When we give number criteria, we don’t need to use quotes.

So this one was the one case. You need to specially careful when you work with dates. They get messy very easily. So if your formula includes dates in it, check if it is in right format. Sometimes when we import data from other sources,  dates aren’t imported in accepted formats. So first check and correct the dates before using them.

Mistakes While Using Comparison Operator in SUMIF Function

Let’s take another example. This time let’s sum up the quantity of dates later than 1-Mar-13. For this the correct syntax is»

=SUMIF(A2:A20,»>1-Mar-13″,C2:C20)

Not this:

=SUMIF(A2:A20,A2:A20>»1-Mar-13″,C2:C20)

We don’t include the criteria range in criteria because we already told SUMIF the range in which to look.

Now if  the criteria is in some cell, let’s say in F3, than how would you use SUMIF function. Will the below formula work?

=SUMIF(A2:A20,»>F3″,C2:C20)

NO.

Will this.

=SUMIF(A2:A20,>F3,C2:C20)

NO.

This one should do than:

=SUMIF(A2:A20,>»F3″,C2:C20)

A big NO. When we use comparison operators, we use ampersand to between operator and the range. The operator should be enclosed in quotes.

The SUMIF formula will work properly.

=SUMIF(A2:A20,»>»&F3,C2:C20)

Note: When you need to sum values if a value matches exactly in criteria range, you don’t need to use equal to sign «=». You just write that value or give the reference of that value at place of criteria, as we did in the first example.

I have noticed that some new users use the below syntax when they want an exact match.

=SUMIF(A2:A20,A2:A20=F3,C2:C20)

This too much wrong. This SUMIF will not work. When using reference as criteria for exact matches you just need to mention the reference. The below formula will sum all quantities of date written in cell F3:

So these are some syntactical mistakes that can be the reason behind SUMIF not working. Let’s see some other reasons.

2. SUMIF not working due to irregular data format

A little bit of this, we have discussed in the previous section. But there is more to it.

The SUMIF function deals with numbers. Of course only numbers can be summed up. So first you need to check the sum range, if it is in the proper number format.

When we import data from other sources, it is common to have irregular data formats. It is very likely to have numbers formatted as text. In that case the numbers will not summed up. See the below example.

You can see that sum range contains text values instead of numbers. And since text values can’t be summed up, the result we get is 0. The green corner in the cell indicates the the numbers are formatted as text.

It is possible that your range contains mixed formats. It is possible that only few numbers are formatted as text and rest are numbers. In that case those text formatted numbers will not be summed up and you will get an inaccurate result.

How to solve this

To fix this problem, select one cell that contains numbers and text and CTRL+SPACE to select entire column. Now click on the little exclamation mark on the left of the cell. Here you will see an option of «Convert to numbers» on second place. Click on it and you will have all the numbers in selected range converted to number format.

This is one solution. But if you are not able to do this. Use the VALUE function to convert text into numbers. The VALUE function coverts any formatted number into number format (even dates and times).

So this how it works. Use a column to convert all the numbers into values using the VALUE function and then value paste it. And then use that in the formula.

Date and Time Formatted Value Summation  with SUMIF.

SUMIF may not visibly work when you try to sum up times. Yes visibly. See the below example.

Here I have time in HH:MM:SS format. And I want to sum up the hours of date 1-mar-13. So I use the formula:

The formula is absolutely correct but the answer I am getting is not looking right.

Why am I getting 0.5. Shouldn’t it return 12:00:00. Is it incorrect? No. The answer is write. As I said earlier, in Excel the time and date is treated differently. In Excel, 1 hour is equal to 1/24 unit. (I recommend you to understand excel date and time logic in detail. You can learn it here)  So 12 hour will be equal to 0.5.

If you want to see the result in hours convert the cell format of G3 to time format.

Right click on the cell and click on the format cell. Here select the time format. And it is done. You can see that the result is converted to the correct format and returns an understandable result.

If SUMIF isn’t working anyway use SUMPRODUCT

If for any reason, the SUMIF function is not working, no matter what you do, use an alternative formula. Here this formula uses SUMPRODUCT function.

For example if you want to do the same thing as above, we can use the SUMPRODUCT function to do so:

We want to sum range D2:D20 if date is equal to F3. So write this formula.

The order of the variables doesn’t matter. The below formula will work perfectly fine:

or this,

You can learn about summing up with condition using SUMPRODUCT function here. The SUMPRODUCT function is very flexible and versatile function. I recommend you to understand it thoroughly.

So yeah guys, this is how you can solve the issue if SUMIF function isn’t working. I have covered every possible reason that can cause SUMIF’s unusual behavior. I hope it helped you. If it didn’t, let me know it in the comments section below. If you have some new insight, share that too in the comments section below.

Related Articles:

13 Methods of How to Speed Up Excel | Excel is fast enough to calculate 6.6 million formulas in 1 second in Ideal conditions with normal configuration PC. But sometimes we observe excel files doing calculation slower than snails. There are many reasons behind this slower performance. If we can Identify them, we can make our formulas calculate faster.

Center Excel Sheet Horizontally and Vertically on Excel Page : Microsoft Excel allows you to align worksheet on a page, you can change margins, specify custom margins, or center the worksheet horizontally or vertically on the page. Page margins are the blank spaces between the worksheet data and the edges of the printed page

Split a Cell Diagonally in Microsoft Excel 2016 : To split cells diagonally we use the cell formatting and insert a diagonally dividing line into the cell. This separates the cells diagonally visually.

How do I Insert a Check Mark in Excel 2016 : To insert a checkmark in Excel Cell we use the symbols in Excel. Set the fonts to wingdings and use the formula Char(252) to get the symbol of a check mark.

How to disable Scroll Lock in Excel : Arrow keys in excel move your cell up, down, Left & Right. But this feature is only applicable when Scroll Lock in Excel is disabled. Scroll Lock in Excel is used to scroll up, down, left & right your worksheet not the cell. So this article will help you how to check scroll lock status and how to disable it?

What to do If Excel Break Links Not Working : When we work with several excel files and use formula to get the work done, we intentionally or unintentionally create links between different files. Normal formula links can be easily broken by using break links option.

Popular Articles:

50 Excel Shortcuts to Increase Your Productivity | Get faster at your task. These 50 shortcuts will make you work even faster on Excel.

How to use Excel VLOOKUP Function| This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.

How to use the Excel COUNTIF Function| Count values with conditions using this amazing function. You don’t need to filter your data to count specific value. Countif function is essential to prepare your dashboard.

How to Use SUMIF Function in Excel | This is another dashboard essential function. This helps you sum up values on specific conditions.

Explanation 

In this example the goal is to sum the numbers in the range F5:F16 when corresponding cells in the range C5:C15 are not equal to «Red». To solve this problem, you can use either the SUMIFS function or the SUMIF function. The SUMIF function is an older function that supports only one criteria. SUMIFS on the other hand can be configured to apply multiple criteria. Both options are explained below.

SUMIFS solution

In the example shown, the solution is based on the SUMIFS function. The formula in cell I5 is:

=SUMIFS(F5:F16,C5:C16,"<>red") // sum if not "red"

In this formula, sum_range is F5:F16, criteria_range1 is C5:C16, and criteria1 is «<>red». The result ($136) is the sum of numbers in the range F5:F16 when corresponding cells in C5:C15 are not «Red». Note that the SUMIFS function is not case-sensitive. With a criteria of «<>red», SUMIFS will exclude «RED», «Red», and «red». Also note that in the SUMIFS function, sum_range always comes first. To sum numbers when the state is not «TX» , you can adapt the formula like this:

=SUMIFS(F5:F16,D5:D16,"<>tx") // sum if not "tx"

In this formula, sum_range is F5:F16 as before, criteria_range1 is D5:D16, and criteria1 is «<>tx». For more information about using SUMIFS to apply multiple criteria with logical operators (>,<,<>,=) and wildcards (*,?), see this page.

SUMIF solution

The SUMIF function is an older function in Excel that supports only a single condition. To solve this problem with the SUMIF function, you can use a formula like this:

=SUMIF(C5:C16,"<>red",F5:F16)

In this formula, range is D5:D16, criteria is «<>tx», and sum_range is F5:F16. Note that in the SUMIF function, sum_range always comes last. The result ($136) is the same as with the SUMIFS function above. For more information about using SUMIF to apply criteria with logical operators (>,<,<>,=) and wildcards (*,?), see this page.

Notes

  • For a case-sensitive solution, see this formula.
  • To match a substring in a cell, see this formula.

Adding up all the numbers in a single column or row in Excel is easy — the SUM function will work just fine. But what if you only want to sum cells that meet a certain condition – for example, to calculate the total sales generated by a specific product? In this case, Excel has a useful function called SUMIF to help you with the job!

Now, let’s go over what the SUMIF function is and how to use it with various examples, so you can see just how helpful this tool can be! 

What is the SUMIF function in Excel?

The SUMIF function is a perfect choice when you’re looking for an easy way to aggregate certain data quickly. Unlike pivot tables, which may require more advanced knowledge in order to use correctly, SUMIF is relatively easy to get started with. 

Here we have a spreadsheet that shows how much revenue was generated by each product and its packaging:

  • Figure_1_1_Product_Revenue

As you’re looking at the above data, the following questions might cross your mind:

  • What is the total revenue generated by Bali Arabica?
  • What is the total revenue generated from products with prices under $50?
  • What is the total revenue generated from products packaged in paper bags?

The SUMIF function can help you answer those questions quickly. With it, you can sum values based on a single criteria, like those specified by the above questions.

Can I use SUMIF with multiple criteria?

SUMIF does not support multiple criteria. For example, you can’t use it to answer questions like: “What is the total revenue generated by products with paper bag packaging AND prices under $50?“. To work around this limitation, you’ll need to use the SUMIFS function, which is the more advanced version of SUMIF. 

So, while SUMIF in Excel is powerful and easy to use, it does have its limitations. For that reason, you will find several examples in this article using SUMIFS as well as other functions as a workaround for solving cases that cannot be solved using SUMIF.

Excel SUMIF syntax and parameters

Syntax

=SUMIF(critera_range, criteria, [sum_range])

Parameters or arguments

Parameters Description
criteria_range Required. The range of cells that contains the criteria.
criteria Required. The criteria used to determine which cells to add. It can be in the form of a number, expression, cell reference, text, or function. 

Note: You need to use double quotation marks around any text criteria that include logical or mathematical symbols. If the criteria are numeric, you don’t need double quotes.

You can also use logical operators as well as wildcards for partial matching, which makes the function powerful.
Logical operators:
– Equal to (=) 
– Not equal to (<>)
– Greater than (>)
– Greater than or equal to (>=)
– Less than (<)
– Less than or equal to (<=)

Wildcards:
– A question mark (?) — matches any single character. 
For example, “T?m” matches “Tim” and “Tom“.

– An asterisk (*) — matches any sequence of characters.
For example, “*ne” matches “Wayne” and “Jane“.

– A tilde (~) followed by ?, *, or ~ — matches a question mark, asterisk, or tilde symbol.
For example, “fun~?” matches “fun?

[sum_range] Optional. The range of cells to add. If you don’t specify this argument, Excel adds the cells that are specified in the criteria_range argument.

How to use SUMIF in Excel: Basic usage

To have a good understanding of how to use the SUMIF function in Excel, let’s take a look at an example below. Suppose you want to find the total revenue generated by Bali Arabica, and want to store the result in G3.  

  • Figure_3_1_Getting_the_revenue_generated_by_Bali_Arabica

To do that, follow the steps below:

Step 1: Position your cursor on G3 and start entering the formula.

=SUMIF(

Step 2: Enter the range of cells that contains the criteria, which is A2:A9.

=SUMIF(A2:A9

Step 3: Set your criteria in the second argument by typing "Bali Arabica".

=SUMIF(A2:A9,"Bali Arabica"

Note: You can type "bali arabica" or "BALI ARABICA" because SUMIF is not case-sensitive. You can also add the “=” operator in the criteria ("=Bali Arabica"), but the equal sign (=) is not necessarily required when creating the “is equal to” criteria. 

Step 4: Select a range of cells that you want to sum, which is D2:D9. After that, close the parentheses and press Enter.

=SUMIF(A2:A9,"Bali Arabica", D2:D9)
  • Figure_3_2_The_Revenue_generated_by_Bali_Arabica

Let’s see what exactly happened:

  • Excel searched for the word “Bali Arabica” in the range A2:A9
  • If any row had that word, Excel added the revenue value in column D of the same row.
  • In the end, you get the sum of all revenue for Bali Arabica.

Note: If your spreadsheet has many rows, using this formula that refers to the entire column may be more convenient:

=SUMIF(A:A,"Bali Arabica",D:D)

Now, if you’d like, try to calculate the revenue generated from Dark Sumatra, Italian Espresso, and Super Dark Espresso. You can follow the same steps as above (Step 1-4).

Alternatively, you can insert the SUMIF formula from the ribbon menu. To do that, click Formula, and then in the Function Library section, click Math & Trig. Look for the SUMIF function in the list and select it. 

  • Figure_3_3_Inserting_SUMIF_from_the_ribbon_menu

A popup will appear, allowing you to enter the function arguments. See the following arguments for Dark Sumatra. When done, click the OK button.

  • Figure 3.4: Function arguments for Dark Sumatra

Excel SUMIF vs. SUMIFS 

When talking about SUMIF, we really must also discuss SUMIFS. Both functions allow you to sum data based on certain conditions. The difference? SUMIF only supports a single criteria, whereas SUMIFS can handle multiple criteria.

SUMIFS syntax

=SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], …)

The syntax is different from SUMIF in that you need to include the sum_range argument before any other arguments. Also, sum_range is a required argument, not optional like in the SUMIF function. Following the sum_range argument is the pair of the first criteria range and criteria (criteria_range1 and criteria1), and this pair of parameters is also required. 

You can use SUMIFS even for one criteria (like SUMIF). You can add as many criteria as necessary, up to the limit of 127 pairs. 

The basics of how to use these parameters are the same as SUMIF, so we won’t repeat the same explanation here. That means you won’t have to read a longer 😉

How to use SUMIF in Excel if your data is from different sources

Have you ever wanted to analyze data using Microsoft Excel, but your data is stored in external sources such as Jira, PipeDrive, Shopify, etc.? If yes, but you just couldn’t figure out how, our integration tool, Coupler.io, can help you. With this tool, you can import and combine data from different sources into Excel without coding. You can even automate the process on a schedule! 

It’s important to note that your destination file needs to be an Excel Online file on OneDrive. If you want to use a file shared by another user, ensure you have edit access to the file.

To start using Coupler.io, sign up to it (it’s easy and no credit card is required). Then, all you need to do is create a new importer. A wizard will help you configure these three details:

  • Source — You can take data from Airtable, Xero, Slack, Trello, and more.
  • Figure 5.1: Coupler.io data sources
  1. Destination — Select Microsoft Excel. 
  • Figure 5.2: Coupler.io Microsoft Excel destination
  1. Schedule— If you’d like, you can set up automatic data refresh on a schedule: hourly, daily, or monthly.
  • Figure 5.3: Coupler.io automatic data refresh

Pretty easy, right?! Once you finish setting up the importer and run it, your Excel file will be updated. Check out the available Excel integrations.

After that, you can start analyzing your data using Excel. 🙂

Common examples of how to use the SUMIF function in Excel

Understanding the basic use of SUMIF is one thing. But it’s better to be aware that there are many different ways to use this function. Now, let’s look at some common examples so we can get an idea of ​​other fun things we can do with this function.

#1: Excel SUMIF if cells are equal to a value in another cell

With the data below, suppose you want to find out how many items were sold at $200. You can use this formula:

=SUMIF(B2:B9,200,C2:C9)

But instead of typing 200 manually as the second parameter, you can just refer to E3, as shown in the following formula:

=SUMIF(B2:B9,E3,C2:C9)
  • Figure 6.1: SUM if cells are equal to

#2: If cells are not equal to

To calculate using the “not equal to” criteria, use the “<>” operator (with double quotes). 

Now, assume that you want to calculate the total sales generated by products other than Rose in E3 and other than Daisy in E4. Use the following formulas:

  • Not equal to Rose (E4):
=SUMIF(A2:A6,"<>Rose",B2:B6)
  • Not equal to Daisy (E5):
=SUMIF(A2:A6,"<>"&D4,B2:B6)

Notice that for Daisy, we use a cell reference in the formula.

  • Figure 6.2: SUM if cells are not equal to

#3: If cells are less than / less than or equal to a number

Use the “<” operator to mean “less than” and “<=” to mean “less than or equal to“. The following example calculates the quantities of flowers with prices per stem that are:

  • Less than $0.45 (F5):
=SUMIF(B2:B9,"<0.45",C2:C9)
  • Less than or equal to $0.45 (F6):
=SUMIF(B2:B9,"<=0.45",C2:C9)
  • Figure 6.3: SUM if cells are less than, less than or equal to a number

#4: If cell contains text

To sum if cells contain a specific text, you need to use a wildcard when specifying the criteria in the SUMIF function. 

The following example calculates the total quantities of flowers with names containing “white“. Notice again that SUMIF is not case-sensitive. The formula in F5:

=SUMIF(A2:A9,"*white*",C2:C9)
  • Figure 6.4: SUM if cells contain text

#5: Excel SUMIF if cells contain an asterisk

Asterisks themselves are wildcards. So, to find text that contains an asterisk, you’ll need to use a tilde (~) to treat the character literally (not as a wildcard). The following example shows how to sum the amount for items that:

  • Contain * (F5):
=SUMIF(B2:B9, "*~**", C2:C9)
  • Contain * at the end (F6):
=SUMIF(B2:B9,"*~*",C2:C9)
  • Figure 6.5: SUM if cells contain an asterisk

#6: Excel SUMIF to sum values based on cells that are blank

Use double quotes without any space in between ("") in the criteria if you want to sum based on cells that are blank. Blank means empty or zero character length.

For the following spreadsheet, suppose you want to calculate the total bill for works that are still ongoing (not finished yet). To do that, you calculate the sum based on the finish dates that are blank using the following formula:

=SUMIF(C2:C11,"", D2:D11)
  • Figure 6.6: SUMIF based on cells that are blank

#7: Excel SUMIF to sum values based on cells that are not blank

Use the “not equal to” operator enclosed with double quotes (“<>“) in the criteria if you want to sum based on cells that are not blank.

Now, suppose you want to calculate the total bill only for works that are done (finish dates are not empty), use the following formula:

=SUMIF(C2:C11,"<>",D2:D11)
  • Figure 6.7: SUMIF based on cells that are not blank

#8: If date is greater than, greater than or equal to

Use the “>” operator for greater than and “>=” for greater than or equal to. The following example sums the total bill for works that started:

  • After Jun 5, 2021 (F5):
=SUMIF(B2:B11,">6/5/2021",C2:C11)
  • On or after Jun 5, 2021 (F6):
=SUMIF(B2:B11,">="&DATE(2021,6,5),C2:C11)

Notice the formula in F6. You can also use the DATE function in the criteria.

  • Figure 6.8: Sum if date is greater than, greater than or equal to

Check out our guide dedicated to Excel SUMIF with Date Criteria.

#9: Excel SUMIF to sum values with the time format

Excel time values are actually numbers and you can sum them up using the SUMIF function like other numeric values. All you need to do is ensure that your data is in the correct time format. But how to set the correct time format? Well, it’s easy. Here’s an example:

Suppose you want to format Duration (column C) so that it uses the “h:mm:ss” format as shown in the following screenshot:

  • Figure 6.9.1: Formatting a column to h:mm:ss

Follow the simple steps below:

Step 1: Select the entire column C (or only C2:C14 if you want to select this range only).

Step 2: Right-click and select Format Cells

Step 3: Click Custom in the category list, then select h:mm:ss on the right. 

Step 4: Click OK.

Now, let’s say you want to sum the total duration for Specialization 2. You can use the following formula:

=SUMIF(A2:A14,E4,C2:C14)
  • Figure 6.9.2: Sum if values are in time format

Note: When the sum of time can be greater than 24 hours, you should format the result cells to [h]:mm:ss to avoid the wrong total hours displayed in the results. That’s because for the normal time format like “h:mm:ss”, hours will reset to zero every 24 hours.

#10: With multiple OR criteria

To sum numbers based on other cells being equal to either one value or another, one of the solutions is by using multiple SUMIF functions in one formula.

With the following table, suppose you want to sum the quantity sold for either Orchid OR Sunflower. To do that, you can use the following formula:

=SUMIF(B2:B9,"Orchid",C2:C9)+SUMIF(B2:B9,"Sunflower",C2:C9)
  • Figure 6.10.1: Sum with multiple OR criteria

The solution here is very simple, and when there are only a few criteria, it often gets the job done quickly. However, if you want to sum values with more than three OR conditions (let’s say), then the formula will become long and complex. To avoid this problem, check out example #11 below, which uses a more advanced method that does not require adding up all of those different parts separately in order to get your total value.

Advanced examples of how to use the SUMIF function in Excel + without Excel SUMIF

Here are some more examples you may find helpful when summing values with criteria.

#11: Excel SUMIF with an array as the criteria argument

With the following data, suppose you want to sum the quantity sold for either Orchid OR Sunflower

  • Figure 7.11.1: Example data showing the total qty sold per product

Notice that it uses multiple OR criteria, like in example #10. But this time, we’ll use an array in the criteria by following the steps below:

Step 1: List each condition separated by a comma and then enclose with curly brackets: {"Orchid","Sunflower"}

Step 2: Write the complete SUMIF formula using the array:

=SUMIF(B2:B9, {"Orchid","Sunflower"},C2:C9)
  • Figure 7.11.2: SUMIF with an array in the criteria argument - wrong result

However, when you look at the result, the value is not correct. It only sums the total for Orchid, which is 520. And you’ll also see 680 next to it, which is the total for Sunflower. Why?  

The SUMIF formula takes on an array argument that consists of two values. This forces the formula to return two results separately: 520 and 680. Since we put the formula in cell F5, the function only returns one result for this cell — i.e.,  the total for Orchid.

For this technique to work, you have to use one more step:

Step 3: Wrap your SUMIF formula in a SUM function, as follows:

=SUM(SUMIF(B2:B9, {"Orchid","Sunflower"},C2:C9))
  • Figure 7.11.3: SUM + SUMIF with an array in the criteria argument 

As you can see, the array criteria make the formula much more compact compared to multiple SUMIFs, as seen in example #10. You can also use arrays with numbers, but you don’t need to double-quote them.

#12: With date range criteria (between two dates)

Unfortunately, the SUMIF Excel formula does not work for this case. Instead, you have to use SUMIFS. 

With the following data, suppose you want to sum the total bill for works started between 1-Jun-2021 (cell F3) and 12-Jun-2021 (cell F4). Use the formula below:

=SUMIFS(C2:C11,B2:B11,">="&F3,B2:B11,"<="&F4)
  • Figure 7.12.1: Sum with date range criteria

#13: Excel SUMIF by month

Suppose you have the following table and want to find the total bill for works that started in June 2001. To get the result, you can use a SUMIFS function with these two criteria: start dates >= first day of June AND start dates <= last day of June.

  • Figure 7.13.1: Sum by month example

Follow the steps below:

Step 1: Type the first date of June 2021 in E3.

  • Figure 7.13.2: The first day of June

Step 2: Change the format of E3 to “mmmm” to display the month name.

  • Figure 7.13.3: Format the cell to show the month name

Step 3: Write the following formula to F3, then press Enter. Note: The EOMONTH function helps you to find the last day of the month.

=SUMIFS(C2:C11, B2:B11, ">="&E3,B2:B11,"<="&EOMONTH(E3,0))
  • Figure 7.13.4: Sum by month formula

#14: Excel SUMIF by year

Still using the same data with the previous example, suppose you want to find the total bill for works that started in 2020. To get the result, use SUMIFS with these two criteria: start dates >= first day of 2020 AND start dates <= last day of 2020.

=SUMIFS(C2:C11, B2:B11, ">="&DATE(E3,1,1),B2:B11,"<="&DATE(E3,12,31))
  • Figure 7.14.1: Sum by year 

#15: Sum values based on background color

Suppose you have the following profit/loss data and want to sum based on the background color. In Excel, there is no default function to do that. But you can create an Excel VBA function to return the color index of a cell, and then use that index as the criteria in SUMIF.

  • Figure 7.15.1: Sum by color example

Follow the steps below:

Step 1: Press Alt+F11 to open the Visual Basic Editor (VBE).

Step 2: Click Insert > Module.

  • Figure 7.15.2: Inserting a module 

Step 3: Copy-paste the following function to the editor:

Function ColorIndex(CellColor As Range)
    ColorIndex = CellColor.Interior.ColorIndex
End Function
  • Figure 7.15.3: Adding a VBA function

Step 4: Type “Bg Color” as the header of column C. Then, type =ColorIndex(B2) in C2 and copy the formula down to C7.

  • Figure 7.15.4: Using the ColorIndex function in cells

Step 5: Use SUMIF to calculate the total profit based on the background color, as follows:

  • Formula in F2:
=SUMIF(C2:C7, 19, B2:B7)
  • Formula in F3:
=SUMIF(C2:C7, 43, B2:B7)
  • Figure 7.15.5: Sum by color result

Read our guide on Excel SUMIFS VBA.

#16: Excel SUMIF to sum across multiple sheets

Suppose you have identical ranges in separate worksheets and want to summarize the total in the first worksheet, as shown in the following screenshot:

  • Figure 7.16.1: Multiple sheets

To do that, you can use the SUMIF function with INDIRECT, wrapped in SUMPRODUCT. 

See the below steps to calculate the summary for the first salesperson (Kelly):

Step 1: List all the sheet names that are going to be summed in the Summary sheet. For example, in E2:E4 as shown below:

  • Figure 7.16.2: List of all the sheet names that are going to be summed

Step 2: Write a SUMIF formula for one sheet only – for example, Jan.

=SUMIF(Jan!A2:A6,Summary!A2,Jan!C2:C6)
  • Figure 7.16.3: Sum for one sheet only 

Step 3: Nest the formula inside SUMPRODUCT.

=SUMPRODUCT(SUMIF(Jan!A2:A6,Summary!A2,Jan!C2:C6))

Step 4: Replace the sheet reference with a list of sheet names. In this case, 

  • Replace Jan!A2:A6 with INDIRECT("'"&E2:E4&"'!"&"A2:A6")
  • Replace Jan!C2:C6 with INDIRECT("'"&E2:E4&"'!"&"C2:C6")

The complete formula will be:

=SUMPRODUCT(SUMIF(INDIRECT("'"&E2:E4&"'!"&"A2:A6"),Summary!A2,INDIRECT("'"&E2:E4&"'!"&"C2:C6")))
  • Excel SUMIF formula to sum across multiple sheets

#17: Sum multiple columns using one criteria

With the following data, suppose you want to calculate how many roses were sold in three months — Jan, Feb, and Mar. You can’t use either SUMIF or SUMIFS in this case. One alternative is to use the SUMPRODUCT function, as follows:

=SUMPRODUCT((A3:A11="Rose")*(B3:D11))
  • Figure 7.17.1: Sum multiple columns using one criteria

The first expression checks the range A3:A11 and returns an array of TRUE and FALSE. If any cell equals “Rose“, it will return TRUE, otherwise FALSE: 

{TRUE;FALSE;FALSE;FALSE;FALSE;TRUE;TRUE;FALSE;FALSE}

The result above is then multiplied by the values in range B3:D11:

{500,400,300;400,500,200;500,300,400;300,400,500;400,200,500;400,500,200;600,200,300;400,300,200;400,500,300}

The SUMPRODUCT function will calculate the following values, which finally returns 3400.

=SUMPRODUCT({500,400,300;0,0,0;0,0,0;0,0,0;0,0,0;400,500,200;600,200,300;0,0,0;0,0,0})

Limitations of the Excel SUMIF function

After looking at these examples, we are sure you have your own conclusion about the limitations of the SUMIF function. But anyway, here’s the summary:

  • You can’t use Excel SUMIF with multiple AND criteria. SUMIF is designed to handle one criteria only. As shown in example #10, you can use SUMIF + SUMIF for multiple OR conditions. However, you can’t use it with multiple AND criteria. For this case, use SUMIFS instead.
  • You can’t use Excel SUMIF to sum multiple columns at once. As demonstrated in example #17, you can’t use either SUMIF and SUMIFS to sum multiple columns using one criteria. One of the solutions is to use the SUMPRODUCT function.
  • You can’t use Excel SUMIF with an array as its range argument. In example #11, you can see that SUMIF accepts an array in its criteria argument. However, for its range argument, SUMIF requires a cell range. Because of this, you can’t use a formula that returns an array in its range argument — here’s an example:

Suppose you have the following table and want to sum the total bill for works that started in 2020; you can’t use this formula: 

=SUMIF(TEXT(B2:B11,"yyyy"),"2020",C2:C11)
  • Figure 8.1: SUMIF with an array for its range argument

Why? That’s because the TEXT function in the above formula will return an array, which SUMIF doesn’t support. 

What to do when your Excel SUMIF function is not working

There are times when you’ll find that your SUMIF formula in Excel is not working, or returns inaccurate results. There can be many reasons for that. Most of them have to do with incorrect ranges and defining criteria incorrectly. Thus, we recommend checking the following points:

  • Check the order of the arguments used in the formula. For example, if you use three arguments, remember the first argument is the range that contains criteria, not the range you want to sum. You might have confused this with the SUMIFS formula.
  • Check the range of cells you use, especially if you copy-pasted the formula from another cell. These include the range you want to sum as well as the range that contains the criteria.  
  • Ensure that you use double quotation marks (“”) for any criteria other than numeric.  
  • Check the format of the values involved in the calculation. For example, if you sum values with the time format, ensure you use the correct time format for your range values and the result cells. 
  • You are sure that you’ve written the correct formula. Still, when you update the sheet, the SUMIF function doesn’t return the updated value? Well, in this case, check the formula calculation option in your spreadsheet. If it’s set to manual, press the F9 key to recalculate the sheet.  
  • Figure 9.1: The formula calculation option

Finally, you’ve learned about the SUMIF function, including what it is, its syntax, how to use it, and its differences with SUMIFS. We also have covered various examples, as well as what to do when your function is not working. 

We hope this article helped you, but if it didn’t, let us know if you have any comments or suggestions in the comments section below.

  • Fitrianingrum Seto

    Senior analyst programmer

Back to Blog

Focus on your business

goals while we take care of your data!

Try Coupler.io

I am trying to use SUMIFS to sum a couple of conditions. I want my sum range to be column A and my first criteria range is column B, the criteria is that column B has something in it or essentially it isn’t blank/0. The next criteria is if column C matches the year which is simple and I can get that to work, but my problem arises from the criteria of the first test. I have tried:

  1. SUMIFS(column A, column B, column B > 0, column C, "16")
  2. SUMIFS(column A, column B, column B <> 0, column C, "16")
  3. SUM(SUMIFS(column A, column B, "1", column C, "16"), SUMIFS(column A, column B, "2", column C, "16"), SUMIFS(column A, column B, "3", column C, "16")

Obviously, I do not want to use option 3 but it did seem to give me the right result. If I knew that the number in column B would be always under 5 then I may use this but as of now, I have to assume the number in column B can be from 0-1000. Is there something I am missing here?
All I want to do is sum up column A if column B is not blank or 0. Thanks.

Ivan Aracki's user avatar

Ivan Aracki

4,68311 gold badges59 silver badges69 bronze badges

asked Jun 15, 2016 at 13:43

ryan's user avatar

Better answer found at ExcelJet

Use only "<>" as criteria, e.g.

=SUMIF(C5:C11,"<>",D5:D11)

This allows rows in criteria column to be included if their value is zero, thus excluding ONLY blanks in the criteria column.

answered Feb 21, 2018 at 8:51

Renier's user avatar

RenierRenier

4805 silver badges13 bronze badges

You can do SUMIFS() with comparison as criteria by enclosing your criteria in quotation marks:

=SUMIFS(A:A,B:B,">0")

Note that >0 criteria also works for blank cells as Excel evaluates them to zero.

However, if you do it this way:

=SUMIFS(A:A,B:B,"<>0")

blank cells will pass the criteria, only cells containing 0 value will be skipped.

answered Jun 15, 2016 at 13:51

ttaaoossuuuu's user avatar

ttaaoossuuuuttaaoossuuuu

7,7563 gold badges28 silver badges56 bronze badges

3

I am not getting correct result with «<>».
Column A contains numbers. Column B has formulas which gives an amount or a blank.
I used the formula ‘=SUMIF(B:B,»<>»,A:A)’.
This formula adds up all numbers in Column A, even if corresponding cells in Column B are blank (based on formula)

answered Dec 19, 2020 at 15:42

Bipin Shah's user avatar

2

Понравилась статья? Поделить с друзьями:
  • Excel not grouping columns
  • Excel not graphing data
  • Excel not function 2007
  • Excel not filtering all data
  • Excel not cutting and pasting