Excel SUMIF and SUMIFS Statements Explained

Excel 2007 SUMIF and SUMIFS Formulas Explained

by on September 10, 2010

in Excel,Microsoft Office Training,Online Training

In this Microsoft Office Online Training article we’re going to explain how to use the SUMIF and SUMIFS Formulas, and look at a couple of different applications for them.

You can download the workbook used in this example and practice what you learn.

Learning the SUMIF formula extends the capabilities of the basic SUM formula by allowing you to tell Excel to only SUM items that meet a certain criteria.  Whilst the SUMIFS is new in Excel 2007, it allows you to stipulate multiple criteria, hence the plural.

Enough explanation, let’s dive into an example as it’s easier to visualise.

SUMIF Formula first:

The function wizard in Excel describes the SUMIF Formula as:

=SUMIF(range,criteria,sum_range)

Not very helpful is it?  Let’s translate it into English with an example.  In the table below we want to sum the total number of Units (in column D) for Dave:

Excel-SUMIF-and-SUMIFS-Formulas-explained

Translated, our formula would read like this:

=SUMIF(the name in column C, = Dave, add the figures in column D)

We could even put a summary table at the bottom of the list for each builder like this:

Our formula in cell D12 would be:

=SUMIF(C2:C7,”Dave”,D2:D7)

While the above formula is good, if we were to copy it to the rest of the summary table (cells D11 to D14 and F11 to F14) we would have to manually change the cell references and builder’s name to get the correct answers.

The solution is to use absolute references to help speed up the process of copying the formula to the remainder of column D and column F.  With absolute references our formula would look like this:

=SUMIF($C$2:$C$7,$C12,D$2:D$7)

We could then copy and paste the formula to the remaining cells in our summary table without having to modify it at all.  As we copied it down column D, Excel would dynamically update the formula to automatically pick up the next builder in the list.  Then when we copied it across to column F, Excel would dynamically alter the reference to column D to F.

The best way to fully understand this conundrum is to try it for yourself.  Download the workbook used in this example here for practice.

Note: I used a basic example to illustrate how to use the SUMIF formula, but you can also achieve this using the subtotal tool in the Data tab.  But that’s a lesson for another day!

SUMIFS Formula:

The function wizard in Excel describes the SUMIF Formula as:

=SUMIFS(sum_range,critera_range_1,criteria_1,criteria_range_2,criteria_2…..and so on if required)

Extending the SUMIF example above, say we wanted to only summarise the data by builder, for jobs in the central region.  We could use the SUMIFS formula as it allows us to set more than one condition.

Here’s how the formula would be interpreted if we wanted to add up the Units in column D, for Doug’s jobs in the Central region:

=SUMIFS(add the units in column D if, in column C, they are for Doug and, if in column B, they are also for the Central region)

Note: Excel will only include the figures in column D in the sum when both conditions (Doug & Central) are met.

In Excel our formula would read:

=SUMIFS(D$2:D$7,$C$2:$C$7,$C18,$B$2:$B$7,$B$17)

Excel-SUMIF-and-SUMIFS-Formulas-explained

Note: again I’ve used a simple example to illustrate this formula, but you could also achieve this summary table for each builder by region using Pivot Tables. To watch a tutorial on how to insert a Pivot Table sign up to our Premium Microsoft Office Online Training or read our Pivot Table Tutorial.

Try other operators in your SUMIF and SUMIFS

Just like the IF formula, the SUMIF and SUMIFS are based on logic.  This means you can employ different tests other than the text matching (Doug & Central) we’ve used above.

Other operators you could use are:

  • =             Equal to
  • <             Less Than
  • <=           Less than or equal to
  • >=           Greater than or equal to
  • <>           Less than or greater than

For example, if you wanted to sum units greater than 5 the formula would be:

=SUMIF($D$2:$D$7,”>5”,$D$2:$D$7)

Don’t forget to download the workbook used in this example and practice what you’ve learnt.

Then check out our other conditional logic articles IF Statements Explained and COUNTIF and COUNTIFS Formulas Explained.

Did you find this useful, or just confusing?  Let us have your feedback below.

FREE PDF Download
100 Excel Tips & Tricks

Excel Tips & Tricks E-Book
Just enter your details below

Leave a Comment

{ 34 comments… read them below or add one }

Kim September 22, 2010 at 10:37 am

Thanks for this. I’ve always found these difficult but this helped lots :)

Reply

Mynda September 29, 2010 at 8:33 pm

@Kim, glad I could help.

Reply

webdesigner October 8, 2010 at 1:16 am

Simply discovered your web page through google and I consider this can be a disgrace that you are not ranked upper due to the fact that that is a fantastic post. To switch this I determined to avoid wasting your web site to my RSS reader and I will try to point out you in one of my posts since you actually deserv extra readers when publishing content material of this quality.

Reply

Mynda October 8, 2010 at 12:27 pm

@webdesigner – thanks. I’m glad you liked it and are spreading the word.

Reply

JumgrerbJek November 26, 2010 at 9:34 am

thanks

Reply

dart December 31, 2010 at 12:07 am

Great blog , thanks for the post!

Reply

Stiller January 1, 2011 at 6:43 am

This is really a great article! I have only one question. How do you do it? Everything on this site is so good.

Carry on the nice work!

Reply

Graig Liedtke January 1, 2011 at 12:42 pm

Amazing website. I am going to want some time to think about the website=)

Reply

Adam January 21, 2011 at 8:03 am

I want to say your blog is kinda awesome. I always like to read something new about this because I have the similar blog in my Country on this subject so this help´s me a lot. I did a search on the issue and found a good number of blogs but nothing like this.Thanks for writing so much in your blog.. Greets, Adam

Reply

Carmine Milbourne January 27, 2011 at 6:15 pm

thanks to the author for taking his time on this one.

Reply

andrew christian August 12, 2011 at 3:53 am

thank you for this blog

Reply

Sunil August 12, 2011 at 10:44 am

Thanks for the post. I’ve been using SUMIFS but lately I have been having challenges making the “” operator work for non-numeric ranges.

Like in your example, if I want to add all the units for Builder other than Doug, the formula
=SUMIFS(D$2:D$7,$C$2:$C$7,”Doug”,$B$2:$B$7,$B$17)
doesn’t seem to work.

Reply

Sunil August 12, 2011 at 10:45 am

Sorry, I meant to put a “” before the word “Doug” in the formula..
=SUMIFS(D$2:D$7,$C$2:$C$7,”Doug”,$B$2:$B$7,$B$17)

Reply

Sunil August 12, 2011 at 10:46 am

=SUMIFS(D$2:D$7,$C$2:$C$7,”Doug”,$B$2:$B$7,$B$17)

Reply

Mynda Treacy August 12, 2011 at 11:03 am

Hi Sunil,

Have you downloaded the workbook I used in the example above and reverse engineered how mine is working? This might help you figure out what’s going wrong with yours.

Otherwise, drop me an email with your example and I’ll take a look. Just log a ticket on the help desk.

Kind regards,

Mynda.

Reply

Scott September 25, 2011 at 6:28 am

in earlier versions of Excel, before SUMIFS, isn’t there a method of multiple criteria summation using SUMIF(AND… or IF(AND…Sum(…?
I have tried several attempts but so far unsuccessful.

Reply

Mynda Treacy September 26, 2011 at 7:13 pm

Hi Scott,

Yes, there is an alternative to the SUMIFS function if you don’t have Excel 2007 or 2010. It’s called the SUMPRODUCT function and you can see examples of how you can use it to achieve the same results as SUMIFS here:

SUMPRODUCT an alternative to SUMIFS

Kind regards,

Mynda.

Reply

glenn November 3, 2011 at 11:09 am

I am trying to figure out the function of “” and “=E” in this Sumif formula

IF(SUM(L10:P10)=0,”",SUMIF(L10:P10,”")-SUMIF(L10:P10,”=E”))

the cells L:P are numerical and represent student marks.
thanks

Reply

Glenn November 3, 2011 at 1:37 pm

Hi having a problem understanding the meaning and function of the “” and “=E” in the following formula.

IF(SUM(L10:P10)=0,”",SUMIF(L10:P10,”")-SUMIF(L10:P10,”=E”))

can anyone help me out here. to give context, the formula sums student marks and the values are numeric
thanks

Reply

Glenn November 3, 2011 at 1:42 pm

the formula as shown above is not pasted correctly. the first sumif should have a “not equal” between the inverted commas. I am not sure how this “not equal” is working (ie its intended function)

Reply

Mynda Treacy November 3, 2011 at 9:08 pm

Hi Glenn,

When double quotes are used in a formula the are referring to a blank cell. Anything within double quotes, like your “=E” example stipulates that the contents is text.

Your formula will not work since it’s telling Excel to:

IF the SUM of L10:P10 = 0, then put nothing in the cell, otherwise SUMIF L10:P10, where the contents of the cell is empty, minus SUMIF L10:P10, where the contents of the cell is =E.

This formula is incomplete. A SUMIF needs two ranges, the first range is the range with your criteria, the second range contains the values you want to sum.

So for example your formula might read: SUMIF(L10:P10,”",L11:P11) which says sum the range L11:P11 where the corresponding cells in the range L10:P10 are empty.

If you want to send me your workbook I’ll take a look at the formula for you. Just complete a ticket on the help desk.

Kind regards,

Mynda.

Reply

teay January 10, 2012 at 4:04 pm

good explanation

Reply

Mynda Treacy January 10, 2012 at 9:06 pm

Thanks Teay!

Reply

Leo January 24, 2012 at 4:37 am

HI

Reply

Leo January 24, 2012 at 4:44 am

Hoping for sucess

Reply

Philip Treacy January 24, 2012 at 10:24 pm

hope we can help you achieve it Leo

Reply

Pauline February 2, 2012 at 9:33 am

Mynda..Wow..Great explanation! I finally understand the spreadsheets that were passed down to me at work! Thank you so much.

Reply

Mynda Treacy February 2, 2012 at 8:20 pm

Thanks Pauline :)

Glad I could help.

Kind regards,

Mynda.

Reply

Gary Petersen February 4, 2012 at 6:29 am

I’m having trouble with this function when I try to use a reference to a cell with a >= or =G1″,$A$2:$A$7,”=G1″ with the number for that date and “<G2" with the number for that date, it works. I'll download your spreadsheet later and will try it, but it isn't working withi mine. Any ideas?

Reply

Mynda Treacy February 4, 2012 at 10:20 pm

Hi Gary,

I’m not 100% clear on your question but I have a feeling that if you try to format your references using >= or =”&A7,criteria2_range,”= are in double quotes and they’re joined to the cell containing the date with the ampersand.

I hope that helped you out, but if I was off the mark please let me know with the exact sample of your formula that isn’t working.

Kind regards,

Mynda.

Reply

Gary Petersen February 7, 2012 at 1:38 am

Odd, it looks like my comment got garbled. I had written more than that. What I was trying to convey is this.

The SUMIFS formula works quite well when you define the criteria specifically in the formula, but not so well when you tie the criteria to a cell reference. For example, if were to add a date of 2/1/2008 in cell G1 and desire to sum all of the units sold after that date, I think the formula would look like this:

=SUMIFS(D2:D7,A2:A7,>=G1)

I get a result of 0 when I input that formula, however. If I put the actual number representing 2/1/2008 in the formula, it works. The Excel number for that date is 39479. That forumula would look like this:

=SUMIFS(D2:D7,A2:A7,>=39479)

It returns the correct value of 36. I didn’t follow your thought about using the & reference. Can you explain further?

I understand that the SUMIF formula would work for a single criteria, such as my example. What I’d like to do, however, is define two dates and set up the SUMIFS formula to total everthing between them. The problem exists whether one or two criteria are defined.

I’ll check back to see if this comment goes through okay. If it doesn’t, I’ll put a file on my web page with the information. Thanks, Gary

Reply

Jim Baran February 22, 2012 at 5:55 am

Hope this helps me.

Reply

Lewis April 20, 2012 at 9:40 pm

Hi there. I’m trying to create a recruitment report regarding successful/unsuccessful applicants and unsure how to create a formula where if they are successful, the total is counted.

Just now, I am trying this: SUMIF(K2:K20, \=Yes\, K2:K20) but it comes up as zero.

Your help would be appreciated!

Reply

Mynda Treacy April 22, 2012 at 8:45 pm

Hi Lewis,

Let’s say in column B you have the word “successful” or “unsuccessful” you could use the COUNTIF function like this to count the successful applicants:

=COUNTIF(B2:B20,”successful”)

or like this to count the unsuccessful applicants:

=COUNTIF(B2:B20,”unsuccessful”)

More on the COUNTIF Function.

Kind regards,

Mynda.

Reply

Previous post:

Next post: