In this tutorial we’re going to explain how to use Excel SUMIF and SUMIFS Functions, 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 SUMIF extends the capabilities of the basic SUM function by allowing you to tell Excel to only SUM items that meet a certain criteria. Whilst the SUMIFS function, new in Excel 2007, allows you to stipulate multiple criteria, hence the plural.

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

**Excel SUMIF Function**

The function wizard in Excel describes the SUMIF Function 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:

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 it 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 SUMIF, but you can also achieve this using the subtotal tool in the Data tab. But that’s a lesson for another day!

**Excel SUMIFS Function**

The function wizard in Excel describes the SUMIF Function 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 function 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 arealsofor 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)

Note: again I’ve used a simple example to illustrate this, but you could also achieve this summary table for each builder by region using a Pivot Table. To watch a tutorial on how to insert a Pivot Table sign up to our Premium Microsoft Office Course 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.

VEITINIA says

I would like a formula to find

– there are 7 subjects, only English plus best 4 to be counted leaving out 2 subjects

Catalin Bombea says

Hi Veitinia,

Please prepare a sample file with detailed instructions on what you are trying to achieve, I will gladly help you.

You can upload the file on our Help Desk (create a new ticket).

Cheers,

Catalin

GOPI says

Hi ,

I have done my project with your support .And really sumifs formula is very beauty full.

Thank you.for your support and extant the same.

Kind Regards,

Gopi.A.

Mynda Treacy says

You’re welcome, Gopi

Titus says

Hello,

Can you explain the below formula?

=IF(C2=C1,””, SUMIF(C:C, C2,E:E ))

Titus

Catalin Bombea says

Hi Titus,

If C2=C1, SUM column E, but only the rows where column C equals to the value from C2.

Catalin

Heather Ratliff says

Thank You that worked amazingly!

Catalin Bombea says

You’re wellcome, i’m glad it worked

Heather Ratliff says

I am currently using this formula in my excel to calculate the number of people per line of business are on this spreadseet using an array formula

=SUM(IF(F13:F85=”NY MEMBER”,1,0))

I have column C that has three text options: Late, Call OFF and NCNS.

How do I configure the calculation to calculate the number of calloffs per that line of business only? I hope I explained that right for you.

I am trying to calculate how many calloffs per line of business by excluding the ncns and lates.

I hope that you can help . Thank You!

Catalin Bombea says

Hi Heather,

This formula is similar to that array formula, but it’s a normal formula:

Use this for the second step you need:

Catalin

PELYMINA D'SILVA says

Roll No. Name of the student SCIENCE HISTORY GEOG MATHS TOTAL

1 Almeida Aloma Xena A C B E

2 Amonkar Nidhi D C A E

This is excel sheet

In the total column i want the total grade’s points

and the grade’s points are:-

for A-5, B-4, C-3, D-2, E-1

(what will be the formula)

Catalin Bombea says

Hi Pelymina,

Try this formula:

In C2:F2 there should be the letters corresponding to grades.

It should give you the desired result.

Catalin

Donna says

Organization refuses to create a category and allows users to free form entry of school names. Trying to create a SUMIF to cover an array of variations of the name of the school. The SUMIF works with only one “wildcard” text name. For instance, school called “Northwest Elementary,” so I entered “*Northwest*” to include any mention of the school name. But some users abbreviated it “NWES.” How can I include a named range (my array) or multiple wildcard variations in the SUMIF formula?

SUMIFS seems to cover only AND conditions and not OR.

Would appreciate any guidance you can give me. And I VOLUNTEER for this as community service for my Master Gardener certification.

Catalin Bombea says

Hi Donna,

You can try a minimum search string that covers all situations, like: “*N*Wes*”, or just “*N*W*”

If this is not working, upload a sample file at our Help Desk, for a personalized solution.

Catalin

Fakhar says

Profit Sales

1000 1000

1200 2000

1300 2300

-1000 500

-2000 600

-5000 700

Above mentioned is my data. I want to sum all the sales falling next to the negative profit figure. The total/Result should be 1800/-.

Please guide.

Catalin Bombea says

Hi Fakhar,

try this :

Catalin

george says

i have big data from 2000-10 with sales. want to count sales in 2000 >100k, 2nd field bn 101k and 500k etc. use pivot 2007

Catalin Bombea says

Hi George,

Using a pivot table to manipulate large data sets is a good idea. You can use value filters on sales column to get the desired results. From your message, it’s hard to understand what you need, maybe you can give us more details and show us where you need help in this process.

Cheers,

Catalin

Guy Smith says

What a life-saver! Easy to understand and to apply. Thank you very much.

Mynda Treacy says

Thanks, Guy. Glad I could help

seereen says

Thank you for wondore information with proper example

Mynda Treacy says

You’re welcome, Seereen

Bill says

Mynda, I have a row of numbers, I need to sumif only the ones that are formatted in a color Like red. Thanks

Catalin Bombea says

Hi Bill, you can use UDF’s, as this is not possible with regular excel functions. You can find from the web the list of excel color index, or you can use the function CellColorIndex to find the index color of your range. Then you can use that index in SumIfByColor function.

`Function CellColorIndex(InRange As Range, Optional _`

OfText As Boolean = False) As Integer

Application.Volatile True

If OfText = True Then

CellColorIndex = InRange(1, 1).Font.ColorIndex

Else

CellColorIndex = InRange(1, 1).Interior.ColorIndex

End If

End Function

Function SumIfByColor(InRange As Range, _

WhatColorIndex As Integer, SumRange As Range, _

Optional OfText As Boolean = False) As Variant

Dim OK As Boolean

Dim Ndx As Long

Application.Volatile True

If (InRange.Rows.Count <> SumRange.Rows.Count) Or _

(InRange.Columns.Count <> SumRange.Columns.Count) Then

SumIfByColor = CVErr(xlErrRef)

Exit Function

End If

For Ndx = 1 To InRange.Cells.Count

If OfText = True Then

OK = (InRange.Cells(Ndx).Font.ColorIndex = WhatColorIndex)

Else

OK = (InRange.Cells(Ndx).Interior.ColorIndex = WhatColorIndex)

End If

If OK And IsNumeric(SumRange.Cells(Ndx).Value) Then

SumIfByColor = SumIfByColor + SumRange.Cells(Ndx).Value

End If

Next Ndx

`End Function`

Catalin

william says

Hi,

I need help with this one:

=SUMIFS(S3:S1000,Q3:Q1000,TODAY()-1,T3:T1000,”<=41751")

Here "<=41751" means before a specific date like 2014-04-25.

but this date is in a cell and of course can change.

Any answer ?

Thanks

Catalin Bombea says

Hi,

Try this:

, this way 41751 is treated as a number, not a text string…

Catalin

Lizz Higgins says

How do you get a sumif H$5″,$D$2:$D$7) I can’t get a read on the date cell, but it gives me no error.

Catalin Bombea says

Hi Lizz,

The formula should look like: =SUMIF($D$2:$D$7,H$5)

First argument is the criteria range, second argument is the criteria to be searched in the criteria range. The third argument is optional, and must be used only if the range to sum is different than the criteria range. As an example, if you want to sum cells from range E2:E7, but the criteria is on D2:D7, the formula will be: =SUMIF($D$2:$D$7,H$5,E2:E7)

Catalin

Mohammad Salauddin says

helpful

Mynda Treacy says

Thanks, Mohammad

Mudassir Hussain says

really helpful in excel working peopele

Mynda Treacy says

Thanks, Mudassir

Arslan Tariq says

Approved Formulas:

=SUMIFS(H2:H17,A2:A17, “>=19999”,A2:A17, “<=30000")

=SUMIFS(Sheet1!H2:Sheet1!H17,Sheet1!A2:Sheet1!A17, A2)

Optional Formulas:

=VLOOKUP(A2,Sheet1!$I:$J,2,FALSE)

=SUMIFS(H2:H17,A2:A17, "a")

Mynda Treacy says

Thanks Arslan, but I’m not sure what you’re getting at. Perhaps you’d care to elaboarte?

fazilahmad says

thanks from this page

Mynda Treacy says

You’re welcome, Fazilahmad

Adam says

=SUMIF(C2:C7,”Dave”,D2:D7) in this formula if i want to select 2 category s names let see one is Dave and East how can i apply the formula.

Rigion & Builder

Mynda Treacy says

Hi Adam,

You need the SUMIFS for that:

Kind regards,

Mynda.

Vikram Chaurasiya says

Respected sir/madam,

I would kindy request to you pls help me regarding this formula :- K49*10^6/$K$5/10^4 so which types of formula i can make reqarding this symbol :- ^

Thanks,

Vikram

Carlo Estopia says

Hi Vikram,

It would be better if you’d state what type of math

you are using here. To be honest, we are not

statisticians/engineers/mathematicians so we

will know what exact built-in function is equivalent to this

computation of yours.

If you have time, send it here: HELP DESK.

Cheers,

CarloE

Amy says

Hello there,

Great website! I am trying to apply your SUMIF formula to my own spreadsheet, but having trouble figuring out how to make this work because my range is a list of DATES- (formatted as 1/1/13).

Can you tell me what your formula would look like if you were sorting by date (column A) in your first example above instead of sorting by name (in your example- “Dave”). In other words, if you were looking to find out how many units were sold in a given MONTH, rather than by a given BUILDER.

Thank you much!

Amy

Mynda Treacy says

Hi Amy,

Here is a tutorial on SUMIF/S using dates.

Kind regards,

Mynda.

Anthony Scott says

Thankyou so very much!! Extremely helpful!!! Thanks again

Mynda Treacy says

You’re welcome, Anthony

Sam says

Hi,

what if the “range” is dynamic, for example I don’t know in which column I need to search for the string?

in that case, can I use Match function to find the column name? how?

Can u pls help?

Thanks.

Mynda Treacy says

Hi Sam,

Not really. How many columns are we talking about? Can you just do multiple SUMIFS and add them togehter?

Kind regards,

Mynda.

Ryan says

using the sumif formula; what if your ranges are not all next to each other. In other words, the cells that I want to use for the range and sum range are scattered throughout the worksheet.

Mynda Treacy says

Hi Ryan,

No, the columns don’t all have to be adjancent to each other, but the size of the ranges should be the same e.g.:

In the above formula the number of rows in the range and sum_range are 9.

Kind regards,

Mynda.

Roger says

This is what I was expecting. Explanation excellent…

Mynda Treacy says

Cheers, Roger

Manikandan.C says

My Formula is =SUMIFS(Summary!M:M,Summary!F:F,”G5″,Summary!E:E,”Active”,Summary!C:C,”CHN”,Summary!N:N,”Not Bulk”,Summary!O:O,”Positive”)

Mynda Treacy says

Was that a questions, Manikandan?

Manikandan.C says

Thanks For the Posting

Tommy says

I want to know it you can help me i battle with my sheet to date() to get some information please let me knoe if i can send my workbook for help

Thanks Tommy

Carlo Estopia says

Hi Tommy,

Yes of course, please send your workbook with explanations via HELP DESK.

Cheers,

Carlo

Chris Bankes says

Hi,

I have a table where I want to use a sumif where it checks a PO has been raised for the month of January and give me a value. Now the month of January is in a date which has to be converted to a month. i.e. 24/01/2013 -> January. E.G.

PO Received 01/01/2013 £1,751.00

PO Received 01/01/2013 £1,035.00

PO Received 01/01/2013 £4,200.00

PO Received 07/01/2013 £146.14

PO Received 07/01/2013 £247.20

PO Received 08/01/2013 £150.50

Is there a simple way of doing this?

Carlo Estopia says

Hi Chris,

Try doing this with tables and then try a formula like this:

Assuming the table below.

In a nutshell, to create a table, simply highlight the range (including headers) of your data.

Then, go to insert ribbon and click 'Table'. Once you have the table you can now reference them

like I did with the formula above.

Read more: Tables, SUMIFS

Note: You must make sure your criteria date and your dates must be consistent as to format.

Cheers,

CarloE

dennis says

Hello,

I am having a problem using Not Equal to in SUMIFS formula where the not equal to value is referenced. These don’t work as my range name and cell reference are essentially text.

sumifs(a:a,b:b,”rangename”) or

sumifs(a:a,b:b,”c1″)

I have tried a bunch of syntax options, but cannot accomplish the task.

I need it to refer to another cell or range name that is derived from user input and not have it hard coated into the formula.

Any suggestions would be appreciated.

Thanks

Carlo Estopia says

Hi Dennis,

Assume this data at A1:B2 :

Now use formula in this one:

or you may add a named range for Range A1:A2 and name it YourRange or whatever your range name is.

Read More: Named Range

Cheers.

CarloE

dennis says

Apologies, the example translated poorly in this text box.

it was a list of values for each fruit, sum for each and a sample of each formula type trying to exclude one of the reference columns.

D / E

Apple /3

Orange/8

Pear/1

Apple /5

Orange/2

Pear/6

Apple/9

Orange/7

Pear/4

I was trying to exclude Apple in the formula as either a referenced cell or range name. The only correct answer (28) was when the text value was included in the formula.

=SUMIFS(E:E,D:D,”$A$1″) = 45 incorrect

=SUMIFS(E:E,D:D,”Apple”) = 28 correct

=SUMIFS(E:E,D:D,”AP”) = 45 incorrect with AP being a range name

i tried a bunch of alternate format options and they all resulted in errors. (original example had a column total that doubled the counts)

Thanks

Carlo Estopia says

Hi Dennis,

Don’t put double quotations around your criteria when you want it to be interpreted as other than text/string.

Example:

referencing a cell

referencing a named range

Cheers.

CarloE

R Smith says

Thank you!

Jason Forrest says

Hi,

I can’t seem to get any SUMIF functions to work. I have excel 2007 and I downloaded your Excel_Blog_Workbooks file, however When I click on a SUMIF cell and then either click off it or try and press enter, I get a “The Formula you typed contains an error” even though I never changed anything and the formula in theory should work.

Any suggestions?

Carlo Estopia says

Hi Jason,

I tried to download the file and nothing is wrong even as I simulated the actions

you did that created or triggered the error.

I suggest it is about your Excel’s regional settings or something.

I had this German project before and there are some differences like

We used dots/periods for decimals while they use comma’s for it.

In formulas, we use comma’s to separate arguments while they use

semi-colons. So I’m just saying maybe it has some relevance to your

problem.

So I suggest this:

source: Microsoft Support

Cheers.

CarloE

Jory says

Using the SUMIF formula I am summing amounts on a different tab in the same workbook as my unique identifier (in this case, employee ID). If I were to sort the rows on the tab where the formula is entered, using the filter button, my SUMIF formula doesn’t completely update. It is almost as if the formula contained an absolute reference ($’s).

=SUMIF(‘Payroll Detail’!A:A,’Expected Payouts’!F85,’Payroll Detail’!G:G)

The “‘Expected Payouts’!F85” portion of the formula is the portion that doesn’t get updated. This formula is on the “‘Expected Payouts'” tab and the information I am trying to sum is on the “Payroll Detail” tab. So what happens is when I sort my information on the Expected Payouts tab (which does include the column where the formula is entered), this particular line was on F85 but now is located on F10 however the formula does not update to F10 like a relative reference formula would. Is this just a constraint of this formula or is there something I am doing wrong?

I appreciate any assistance you can provide. This website has been most helpful so far.

Carlo Estopia says

Hi Jory,

I suspect you’re putting an absolute reference to your criteria. (see italics)

What you should do is simply lose the dollar($) signs. So what you should do is maintain

the absolute references in your SUM range and Range and change your Criteria range from $A$2 to

simply A2 –just an illustration. Do this to your first formula and drag it down as applicable.

I hope it helps.

Cheers.

CarloE

IS says

Mynda,

You can skip my question, I checkled your “named ranges” tutorial. Great help. Many thanks

Mynda Treacy says

Great, glad you figured it out, Igor

Igor Salazar says

Hi – great site… I’m trying to use the SUMIF function using a formula as condition, but doesnt work…

SUMIF(A1:A5;”<$B$7;C1:C5)… The problem is that exceld oesnt recognize B7 as an active cell but as text.

Any idea on how to solve?

Thanks

tommy says

Please HELP

I do have a sheet like…..

A1 = 30

A2 = 40

A29 = 20

A30 = 0

A31 = 0

Sum(a31)

And i dont want the reading in A31 i want the last active reading in this cell

Thanks Tommy

Mynda Treacy says

Hi Tommy,

I’m sorry, I don’t understand what you mean by ‘reading’. Can you please explain a different way?

Kind regards,

Mynda.

Bob Cronin says

Hi Mynda,

Have to admit you have a way of explaining things that really works

I have got myself in really deep and need some help if it’s possible.

I have a worksheet some 5000 lines long

B1 is selected; I need to add the rows from the cell one below selected to the cell one above the row that holds both an S in column A and a 0 in column C.

The number of rows varies greatly between occurrences. =SUMIF appears to be the way to go, but how do I set the bottom limit.

=SUMIF(B2:B?,A2:A?,”P”,C2:C?,>0)

I realise once the formula is there I can filter the page using the “0” to get the lines I need and paste it in to the cells I want, but I just cannot get my head around this. Dumb plumber here

A B C

1 S 0

2 P 5.1876 1

3 P 0.25608 1

4 P 0.14784 1

5 P 20.79 1

6 P 12.9532 1

7 P 8.976 1

8 P 5.94 1

9 S 0

10 P 5.1876 1

11 P 0.25608 1

12 P 0.14784 1

13 P 16.34579 1

14 P 8.976 1

15 P 7.49571 1

16 P 40.81 1

17 S 23.3904 1

18 P 2.794 2

19 P 0.8536 2

20 P 0.4928 2

21 P 19.25 2

22 S 0

23 P 1.727 1

24 P 0.8536 1

25 P 0.4928 1

26 P 19.25 1

27 S 0

28 P 3.905 1

29 P 0.8536 1

30 P 0.4928 1

31 P 19.25 1

32 S 0

Bob Cronin says

Sorry, cannot edit out what looked like nice columns before i hit send

Mynda Treacy says

Hi Bob,

SUMIF/S won’t work in this case because you need the criteria on the row you want to sum, not before/after. For example; row 17 has an S in column A but 1 in column C, so if I understand you correctly you wouldn’t want to sum rows 18-21.

I’m not sure how you can go about this. You ideally need an identifier on each row that classifies the row as something you want to add or want to exclude. Is there any other data you could use to identify the rows you want to include?

Mynda.

Bob Cronin says

Morning Mynda.

Thanks for you reply.

I have uploaded an image file to http://dl.dropbox.com/u/4688931/excel%20grab.gif

The yellow lines are the ones I need to populate with results. As you can see the number of rows between each yellow line varies. E3:E9 needs to be in E2, I3:I9 needs to be in I2, then down a yellow line and I need E11:E17 needs to be in E10, I11:I17 needs to be in I10 ……..

“Cost”, “TotalMaterialCost”, “LabourTotalCost”, “LabourTotalTime” columns needs to sum the values between the yellow lines. E2, I2, K2, M2. Then E10, I10, K10, M10 …….. on and on.

I thought =SUMIFS using the “S” in column A and the “0” in column N would work, but each way I try I’m wrong

Mynda Treacy says

Hi Bob,

SUMIFS definitely won’t work, for the reasons I cited earlier.

I could probably come up with a complicated formula using OFFSET to do this for you but fundamentally the way you have the data laid out isn’t ideal.

What you have here is a combination of a report and a database which makes your data incredibly inflexible for analysis purposes, and application of formulas like SUMIFS.

Ideally you would have 1 more column to house the Dxxxx which would mean you could then use some of the built in tools like Subtotals or PivotTables to automatically summarize the data for you.

e.g. Rows 3:9 would have a D10102 in column A, rows 11:17 would have a D10103 in column A and so on. You would get rid of rows containing S as Subtotals or PivotTables will automatically put these in for you.

How much work is it for you do change the worksheet to this layout?

Mynda.

Bob says

Mynda,

The file is changable just add a new column not a problem, but am I expecting to much from you?

Mynda Treacy says

Hi Bob,

I can’t change the file for you, you need to do that…especially since you only sent me an image. Once that is done you can read through the tutorial for Subtotals or PivotTables and generate the report your need using either of those tools.

If you get stuck I’m happy to help.

Kind regards,

Mynda.

bob says

Thank you very much for the information, im away from my PC just have ipad for net few days but will do as you suggested. And i will let you kno0w how it goes

Thanks for the help

SHAUKAT RAZAQ says

Hi,

I need a best formula for MS Plates Inventory in MS Excel,

Please help me.

Best Regards

Mynda Treacy says

Hi Shaukat,

I’m sorry, I don’t know what MS Plates is.

Kind regards,

Mynda.

Dee says

Hi,

Can you please help me with the SUMIFS example you explain (shown below) HOw would I add a second criteria to my total eg. I want a total units of both Doug and Brian under Central as one total. Not just Doug. I have tried everything but am now lost.

Your formula to get Doug’s total below reads:

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

SUMIFS Central Units Average $k Total $k

Total Doug 8 389 3,112

Total Dave – – –

Total Brian 8 730 5,840

Total Larry – – –

16 560 8,952

I want to be able to have “Doug & Brian” if Central as one sum called say for example… D&B?

Hope you can help me.

Many thanks

Dee

Mynda Treacy says

Hi Dee,

To sum Doug and Brian requires an OR argument, however SUMIFS can only handle AND arguments.

For example SUMIFS formulas read with AND between each criteria. SUM Units where the region = central and the builder = Doug OR Brian. It can’t handle the OR which means you can only choose one criteria from each column.

What you need is the SUMPRODUCT function like this:

=SUMPRODUCT((D2:D7)*(B2:B7=”Central”)*((C2:C7=”Doug”)+(C2:C7=”Brian”)))

The + operator between the Doug and Brian criteria in the above formula tells Excel to SUM Doug OR Brian.

You can read about how SUMPRODUCT works here.

Kind regards,

Mynda.

Tyson says

Having trouble with this: I have a list of dates in one column, profit and loss in another column. I want to be able to keep running totals for each month on another column. do I set the dates and P/L columns in an array and extract the dates or I was using sumif but I couldn’t figure out how the keep a total in the month column being some months will have different numbers of dates.(I.E. Jan might have one transaction, Feb might have 10, March might have 5). I am having trouble with the date ranges in the dates columns \.

Mynda Treacy says

Hi Tyson,

Let’s say your dates are in column A and your P&L figures are in column B, then you can use this formula:

Note: row 1 needs to be blank…or the row above your first formula needs to be blank.

Kind regards,

Mynda.

Tessie says

Thanks for the free download

Mynda Treacy says

You’re welcome, Tessie

AEH says

Hey Guys,

Can any help me with a formula? Basically what i’m trying to achieve is:

If the total of a cell is greater then x minus a per centage from the amount it is over by.

So for example if x is 7500, cell total is 7600, minus 50%, total should be 50.

Can anyone help?

Philip Treacy says

Hi AEH,

So if I understand this correctly you have something like this in your sheet :

A1 = 7500

B1 = 7600

C1 = Your result

So in this case the formula you want in C1 is :

=IF((B1-A1)>0,(B1-A1)*0.5,0)

which translates as :

IF B1-A1 > 0, then the result is (B1-A1)*0.5, otherwise the result is 0

Cheers

Phil

Tim says

Your comment, “Not very helpful is it?” is typical of my opinion of Microsoft help. However, your tutorial did help me understand SUMIF function. Thanks.

Mynda Treacy says

Cheers, Tim. I’m glad I could help you

Shyam says

Hi Mynda,

Well, I am running out of words to admire the way you explain everything about excel….it is right to say that I am excelling in excel

But, I am at a point that I need extra help from you. I need more questions to practice on every condition, formula, etc., in excel. I googled for it, but no luck. I hope my search ends here! I appreciate your response.

Mynda Treacy says

Hi Shyam,

Thanks for your kind words. I find a great place to get practice is by helping answer questions in forums. You often find challenges you wouldn’t have thought of, and as other members of the forum answer the question you are likely to learn a few different ways to solve the problem.

Just type “Excel Forum” into Google and you’re sure to find some.

I hope that helps.

Kind regards,

Mynda.

Tommy says

Thanks for your simple but clear demonstration of Excel formula.

Mynda Treacy says

Cheers, Tommy

Ian says

SUMIF examples using dates would be nice….and SUMIF accross multiple spreadsheets.

Mynda Treacy says

Hi Ian,

Here is SUMIFS using dates.

Here is SUMIF across multiple worksheets.

I hope that helps.

Kind regards,

Mynda.

Pierre Roody says

Good evening, this is the work you do, you have given me much help. I thank you already.

My problem with the function sumifs is that I would add the cells found in SEVERAL worksheets with four conditions.

help me stp. thank you in advance

Mynda Treacy says

Hi Pierre,

You could try the 3D SUMIFS. Actually this tutorial is for SUMIF but you could use SUMIFS instead.

Kind regards,

Mynda.

Dean says

This is a great help.

How can i bring this further by summing if using a word that is only part of a longer word.

For example I want to sumif the word “Apple” is in the cell.

Possible entries are: Green Apple, Red Apple, Granny Smith Apple.

Thanks.

Mynda Treacy says

Hi Dean,

You can use wildcards to search for parts of words:

=SUMIF(range,”*apple*”,sum_range)

Kind regards,

Mynda.

Jay says

Thanks for the sharing your knowlege

Mynda Treacy says

You’re welcome, Jay.

Brian says

You have a very nice website. Thank you for the helpful formulas and especially the easy to understand explanations.

Here is my problem and thanks in advance…I am guessing it is a multiple sum if but am having a hard time finding an example that is close.

For a group project award payout:

1 to 3 team members get payed 2000 each.

Maximum payout is 2000 up to 3…1 person does NOT get 6000

If total teambers is greater than 3 the payout is 6,000 divided by total number of team members.

I am listing each participant on on my excel spreadsheet and want to display the amount of pay each person wil receive

Scenario 1: Total of 1 Player

Team Member 1: $2000

Scenario 2: Total of 3 Team Players

Team Member 1: $2000

Team Member 2: $2000

Team Member 3: $2000

Scenario 3: Total exceeds 3 team members so maximum payout of 6,000 is divided by total of team players

Team Member 1: $1500

Team Member 2: $1500

Team Member 3: $1500

Team Member 4: $1500

Mynda Treacy says

Hi Brian,

You could use this formula:

=IF(COUNTA(team_members)>3,6000/COUNTA(team_members),2000)

Where the team_members is the named range containing the list of your team members.

Kind regards,

Mynda.

John says

Thanks for your site. I am trying to figure out how to use SUMIF, and I thought that you might have solved the problem, but then I ran into a dilemma. You state that you can use the formula:

=SUMIF(A1:A7,$H$7,B1:B7)

AND

You can use the formula

=SUMIF(A1:A7,”>5″,B1:B7)

So, why can’t I use something of the form:

=SUMIF(A1:A7,>=$H$7,B1:B7)

OR

=SUMIF(A1:A7,”>$H$7″,B1:B7)

The first two give me an answer, but the last one bombs out.

I am trying to write a formula that would scan a column for a date that is less than a particular date. And then I want to sum all of the dollar amounts associated with the dates that are less than or equal to that date.

Got any ideas?

Thanks for your help.

John

Mynda Treacy says

Hi John,

I wrote a tutorial on SUMIFS referencing dates here because it can be a bit tricky.

Hopefully you will find your solution on that post.

Kind regards,

Mynda.

bob says

John,

I think you’re looking for the following syntax for =SUMIF(A1:A7,”>$H$7″,B1:B7)

=SUMIF(A1:A7,”>”&$H$7,B1:B7)

aliciajoohee says

wow i’ve learnt a lot so far through this website, it is the best site about excel i’ve found. wowww im so grateful. you’re really awesome, thanks for teaching, sharing those tutorial.

Mynda Treacy says

Thanks, Alicia

Mynda.

SHWETHA says

i want to know whether we can count 1.5 in the cell, for example =SUM(COUNTIF(U5:AY5,”P/P”),COUNTIF(U5:AY5,”P/P”)+SUM(COUNTIF(U5:AY5,”P”)+SUM(COUNTIF(U5:AY5,”P4″,1.5)))

just help me out with this

Here P should be 1

p/p should be 2

and p4 should be 1.5

Mynda Treacy says

Hi Shwetha,

You can add COUNTIF formulas but you don’t need the SUM function as well. e.g.

Kind regards,

Mynda.

Greg McIroy says

Hi … wonderful site you have here. You communicate the training quite well. Unfortunately, I am still left wondering about the SUMIF.

I want to sum the values in column A (A1:A10) when the first character in text column B (B1:B10) is a 2.

I know I can create a new column C using LEFT(B1,1) and use SUMIF(C1:C10,2,A1:A10), but I’d like not to create a new column.

Any ideas? Thanks!

Mynda Treacy says

Hi Greg,

You can use wildcards in your SUMIF to find text in column B that begins with a 2. Like this:

=SUMIF(B1:B10,”2*”,A1:A10)

The asterisk is your wildcard.

I hope that helps.

Kind regards,

Mynda.

Greg McIroy says

Thanks so much Mynda. It’s nice that you can come up with the simplest solution for something that I over-complicated.

Have a great day!

~GregM

Mynda Treacy says

You’re welcome.

Lewis says

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!

Mynda Treacy says

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.

Jim Baran says

Hope this helps me.

Gary Petersen says

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

Gary Petersen says

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?

Mynda Treacy says

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.

Zbig says

Mynda,

Thanks for the explanation on how to use a cell reference in the expression for the test criteria in the SUMIFS formula. I have been trying for quite some time to find a good explanation on how to use this method of using a reference to a cell as opposed to a constant and I finally managed to make it work.

Thanks.

Mynda Treacy says

Thanks Zbig,

Glad you liked it.

Kind regards,

Mynda.

Pauline says

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

Mynda Treacy says

Thanks Pauline

Glad I could help.

Kind regards,

Mynda.

Leo says

Hoping for sucess

Philip Treacy says

hope we can help you achieve it Leo

Leo says

HI

teay says

good explanation

Mynda Treacy says

Thanks Teay!

Glenn says

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

Glenn says

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)

Mynda Treacy says

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.

glenn says

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

Scott says

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.

Mynda Treacy says

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.

Sunil says

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

Mynda Treacy says

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.

Sunil says

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.

Sunil says

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)

andrew christian says

thank you for this blog

Carmine Milbourne says

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

Adam says

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

Graig Liedtke says

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

Stiller says

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!

dart says

Great blog , thanks for the post!

JumgrerbJek says

thanks

Mynda says

@Kim, glad I could help.

Kim says

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