This tutorial explains the difference between the SUMIF and SUMIFS functions in terms of their syntax and usage, and provides a number of formula examples to sum values with multiple AND / OR criteria in Excel. Continue reading
by Svetlana Cheusheva, updated on
This tutorial explains the difference between the SUMIF and SUMIFS functions in terms of their syntax and usage, and provides a number of formula examples to sum values with multiple AND / OR criteria in Excel. Continue reading
Comments page 16. Total comments: 675
I'm trying this formula but its not working on my sheet
=SUMIFS(I10:I88,G10:G88,"AGO - PETROL",H10:H88,"874")
My table has all the columns but when pressing enter key to get the
result comes a #value . Can anyone help me knowing the problem?
Control + Shift + Enter instead of Enter to enter it as an array formula...
Very helpful article, and it got me almost all the way to a solution, but now I am stuck because I can't get the SUMIFS function to apply as an array formula. Right now I am using the following (=SUMIFS($J2:$J152, $L2:$L152, L2, $E2:$E152, E2). I need the values with the $ to stay static and for the values without the $ to move as the formula is applied, but with SUMIFS it doesn't seem to work the way normal formulas work. How can I get SUMIFS to respect the $?!
Thank you.
I believe you would not include the parentheses around the very outside around the =. you would enter the formula, and hit Control + Shift + Enter to create the array formula...
Hi,
Sorry if I missed this in your post. I am using the below formula:
=SUM(IF(FREQUENCY(A2:A367,A2:A367)>0,1))+SUM(IF(FREQUENCY('Sheet2'!A2:A367,'Sheet2'!A2:A367)>0,1))
This gives me a total unique count from two separate sheets. However I now want to count the unique values with criteria attached. I tried the following:
=SUMIFS(IF(FREQUENCY(A2:A367,A2:A367)>0,1),B2:B4367,">="&Settings!B6, B2:B367,"0,1),Sheet2!B2:B367,">="&Settings!B6,Sheet2!B2:B367,"<="&Settings!B5)
However it only comes up with a #Value! error. I feel as though I am missing something obvious with the structure of the nested IF within the SUMIF but I can't see it.
Thanks for any help :)
Just as an update, I attempted nesting the IF functions against the criteria and against the range manually but I was still unable to retrieve a functional result.
Hello, Michael,
To find an error in the second formula we need to see your data. You can send us a small sample table with your data in Excel to support@ablebits.com. Please include the link to this article and the number of your comment.
Thank you for your reply. I worked it out as follows:
=SUM(IF(FREQUENCY(IF(CUKD>=Settings!B8,IF(CUKT"",MATCH("~"&CUKT,CUKT&"",0))),ROW(CUKT)-ROW('Current Year UK'!A2)+1),1))+SUM(IF(FREQUENCY(IF(CUSD>=Settings!B8,IF(CUST"",MATCH("~"&CUST,CUST&"",0))),ROW(CUST)-ROW('Current Year US'!A2)+1),1))
The structure was flawed in that the criteria was being applied but not as part of the SUMIF function, at least not correctly. It was far easier instead to simply specify nested IF functions as above and push as an Array. The named ranges are simply just to reduce loading time for adjusted ranges, it will eventually become a requirement to use SQL to perform the same function, but by that point I think I will migrate from Excel altogether.
After much "Googling", this is the best treatment of this subject that I saw.
Mega-thanks to you Svetlana.
I want to use the sumifs formula but for a "text" in the sum_range. Is this possible? I have a list of products or tours, by date with a particular guide or guides. I am using sumifs to get the criteria of the date and guide name but the resulting answer is in text (product), not a numerical value. What would be the formula for sumifs for a text value?
Thanks in advance!
Hello, Robin,
It's not possible to sum text with SUMIF. The cells must contain numbers, names, arrays, or links to numbers. Empty cells and text cells are skipped.
Hi There are subject codes and grades scattered in various columns & rows in excel sheet . how can i extract counted grades & code in one cell of excel sheet jointly. FOR EXAMPLE CODE 30 GRADE A1 I WANT TO KNOW 4 Columns is there for formula help automatically count and write whole sheet how many code 30 get A1 grade manually count code 30 grade A1 is 4.please solve my problem.
chart is given below.
NAME CODE GRD CODE GRD CODE GRD CODE GRD
RAM 30 A1 41 A1 30 A1 41 A1
SHYAM 41 A1 30 A1 41 A1 30 A1
Advance thanks
As soon as possible please give reply
Hi, There are subject codes and grades scattered in various columns & rows in excel sheet. how can i extract counted grades & codes in one cell of excel sheet. For example code 30 grade A1 how to count how many 30 code get A1 grade manually count code 30 A1 grade is 4. but i want to formula help automatically count and write.Please help me. pandey5375@gmail.com
chart is given below.
NAME CODE GRD CODE GRD CODE GRD CODE GRD
RAM 30 A1 41 A1 30 A1 41 A1
SHYAM 41 A1 30 A1 41 A1 30 A1
Hi,
in my spreadsheet a column has date values. eg
F20 = 1/1/2016, G20 = 120
F21 = 1/2/2016, G21 = 80
F22 = 1/5/2016, G22 = 120
F23 = 1/6/2016, G23 = 100
F24 = 1/9/2016, G24 = 200
and it has been entered so on.
I'm querying F column for the cell having latest date value. here F24 has.
then i want to retrieve cell G24 value in corresponding row, here G24 = 200 and want to store in Cell E2.
Now as i enter new data in F25:G25, F26:G26 and so on Cell E2 should update automatically as per latest date entry in F column.
please guide here how to achieve this in Excel 2013.
Try using max(F:F) as your criterion.
can sombody tell me
how is use this
=sumproduct(K1:K10)*(L1:L10)*(O1:O10)*(P1:P10)*(B1:B10={"A","B","C")*(1)
XAX
THANK'S MAM FOR PROVIDING FANTASTIC FORMULAS TIPS............
Hello Everyone,
...Im a bit stuck on a formula. I hope I can find a solution
I have to create a price list for a bunch of products that have up to 3 different discount prices available depending on the quantity..
How do I write the formula so that the correct amount will appear?
So for example :
When buying :
- a quantity of 49 apples or less, the cost of each apple would be .20 cents each.
- a quantity of 50 - 75 apples, the cost of each apple is .10 cents
- a quantity of 76 - 120 apples, the cost of each apple becomes .5 cents...
Thank You!
Jean
=IF(A176,0.05,0.1))
Where A1 is your product quantity. Just copy down against all products.
Though, if you are discounting, you would be better off listing the full price and applying a discount rate based on cell values held elsewhere.
Dear Svetlana,
I am struggling with the following formula. I would like to sum a1:a200 if b1:b200 contains patrial text match "CMCM*" AND "CMME*" AND "CMCO*", but also if c1:c200 matches with {'sheet2'!a1:a50} (so any match in that range)
I came up with =SUMIFS($A$1:$A$200;$B$1:$B$200;{"CMCM*";CMME*";"CMCO*"};$C$1:$C$200;{'sheet2'!A1:A50}).
The issue in this is that it does sum some of the matches, but I want to sum all possibilities.
Could you help me find the right formula? I hope it is possible.
Best regards, Bram
I found out how it works. The following formula does the trick:
=SUMPRODUCT(--(ISNUMBER(MATCH($C$1:$C$200;'sheet2'!$A$1:$A$50;0)));--(ISNUMBER(MATCH($B$1:$B$200;Formula!$A$1:$A$3;0)));$A$1:$A$200)
where Formula!$A$1:$A$3 contains the partial match criteria.
please some one explain this to me
=1-SUMIFS(AG:AG,AB:AB,AB181,AE:AE,"No")/(1440*224)
Sumif does not consider case because in the examples, bananas matches Bananas.
However, does sumif match the entire cell's text? I.E. if the text being searched for was "banana" would it match "Bananas"?
I think not as I tried it in one of my spreadsheets. In order to match "grape" and "grapefruits" I used "grape*", but my results are not what I expected even then.
I got zero (for the sumif) when I didn't use the '*' wildcard, but the non-zero number I got using the wildcard(s) does not match the number I get when I use the find (button) to look for "grape" ("find" the button, finds subsets of text within the cells so it does find both Grapes and Grapefruits) and then I used "=sum()" of the found text's associated number cell).
What's even more interesting is that the non-zero number I got doesn't match the "=sum()" of ANY combination of the cells I want sumif'd!
For this sumif case it's only four cells of >400 to be summed, but there are other cases where I will need a hundred out of thousands of cells, so I'd like to figure this out.
To figure this out, how can one determine which cells a sumif is summing?
(I.E. what is it doing so I can make it do-right?)
(I don't know if it matters but I'm using Office 2011 on Mac OSX.)
I found out that selecting the cell with the formula and then going to the Formulas tab (Excel 2011) and clicking on Trace Precedents draws arrows from the cells feeding the formula. Clicking it again should show the next prior cell feeding the formula. It worked for my =cell+cell+cell+cell formula, but for my sumif it drew one arrow from the formula to the top cell of the search for text cell, ie, D1. That's it. I can't even find any cell with the number the sumif gives (1076.35).
By the way, in my case the numbers to be sumif'd are 1244.24 + 361.80 + 1047.35 + 433.35 = 3086.74, but the sumif result is 1076.35.
Hi,
The following formulas cannnot work. I tried removing (GL!$BG:$BG,CY$1:CY$2), it works. Apparently, it can't seems to add more than 1 range of cells in the formulas below. Is there any solutions to this? Appreciate your help.
=SUMPRODUCT(SUMIFS(OFFSET(GL!$D:$D,0,MATCH(CY$9&"-"&'Grp PnL'!$T$3,GL!$D$1:$BN$1,0)-1),GL!$D:$D,'Grp PnL'!$D71,GL!$C:$C,CY$3:CZ$6,GL!$BG:$BG,CY$1:CY$2))
Hello, Jacqueline,
It's hard to find the error without looking at your data. Please send us a small sample table with your data in Excel to support@ablebits.com.
Summing Across a Row?
I thought this would be relatively simple but I cannot figure a way to do it (granted I am not a superuser - yet). Here is the problem:
Given a ROW of data as follows:
A,3,B,6,A,5,A,2,B,7
I want to sum all the values which follow an A and then sum all the values which follow a B. So output would be in two cells one for A values which would equal 10 and the other for B values which would equal 13.
I tried using SUMIF array formula but maybe that is not possible. I would hate to have to use a combination of simple IFs as the rows are long and there are a lot of them so thought array formula might help. Any suggestions?
Hello, Eddie,
If the number of values in rows is fixed, you can use this formula:
=SUM(F12*IF(E12="A", 1, 0), H12*IF(G12="A", 1, 0),J12*IF(I12="A", 1, 0),L12*IF(K12="A", 1, 0),N12*IF(M12="A", 1, 0))
=SUM(F12*IF(E12="B", 1, 0), H12*IF(G12="B", 1, 0),J12*IF(I12="B", 1, 0),L12*IF(K12="B", 1, 0),N12*IF(M12="B", 1, 0))
If the rows length varies you need this array formula:
{=SUM(IF(OFFSET(B1:K1, 0, -1) = "A", 1, 0) * IF(ISNUMBER(B1:K1), B1:K1, 0))}
{=SUM(IF(OFFSET(B1:K1, 0, -1) = "B", 1, 0) * IF(ISNUMBER(B1:K1), B1:K1, 0))}
Hi,
Some thing is not right in my function ( ie 'BIN DETAIL'!Y3:Y1000,{"";"="&today()} ) it is giving me the total of one criteria instead of two creteria)
=sum(SUMIFS('BIN DETAIL'!H3:H1000,'BIN DETAIL'!I3:I1000,"",'BIN DETAIL'!X3:X1000,""&"rej",'BIN DETAIL'!Y3:Y1000,{"";"="&today()}))
Can you provide me with a basic difference between SUMIF and SUMIFS?
Thank you.
Hello Julie,
SUMIF adds up cells based on 1 criterion, SUMIFS allows for multiple criteria.
in the first chart (product, supplier).. is there a way to know for example the number of total "Apples" if I leave blank in "supplier"? in other words: if i choose a specific product and supplier, i use sumifs. BUT if i want to leave blank in supplier or product, and want to get the total (would be: blank criteria = consider all). how can I do this? thanks!!!
I would like to use the SUMIFS formula but in the criteria I would like to use the "inverse" of a criteria. For example using your example above I would to sum all items that are NOT supplied by John. This is because sometimes to specify all the criteria would be laborious!!
please help me with this
i need a formula that says
ex.
A2 B2 C2 D2
10 4 40% Not ok
if the result of c2 is equal or less than 50% put "ok" otherwise not ok. thank you very much and i will really appreciate your response.
Hi, Please see spreadsheet below. what i want to do is: Calculate the total of apples in column 1 but only if column 2 is yes.
fruit sold
apples yes
banana no
pineapple yes
pear yes
litchi no
total sold total not sold
apples
banana
pineapple
pear
litchi
Hi - I just can't figure out what to do! This is my first time using SUMIFS ... and I can't get the right answer.
Raw Data
Column A - List of Names
Column C - No. of Hours
Column D - Hour Type (Class, Coach, Administrative, etc.)
SUMMARY
Column H - Name Entered
Column J -- Need to use SUMIFS to total all hours (Column C) for the name in (Column A) that equals the name listed in Column H as long as that Hour Type is NOT "Administrative"
Thanks!!!
Hi,
EXPENSES Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Rent 32903 23984 11990 48653 4745 1720 24218 21844 11752 30100 25235 292
Salaries 42648 18557 16997 47318 43743 12539 12315 43353 26527 17536 41008 2324
Power 12778 43341 10086 31906 17087 47991 28095 25891 16000 7763 22037 1359
Fuel 33187 25257 30246 37761 836 16396 47184 46502 8481 28548 20981 43096
I want to know Jan month Salaries, using sumifs function
I have a large spreadsheet and need an array formula to average month end stock and place it as a starting stock for the next month. I have an array formula as follows {=AVERAGE(IF(R5&G5=$R$5:$R546&$G$5:$G546,$Q$5:$Q546))} but I cant get it to average the following {=AVERAGE(IF(R5&G5=$B$5:$B546&$G$5:$G546,$Q$5:$Q546))}
As you can see I am trying to get the formula to average all in column Q only for those cells in Q that have the same value in Column B & G. I get an answer when the same value is in the same column but i.e value needed to be the same is in the same column as the range but not when I need another reference from a difference cell? I hope I've explained myself
Can someone help me with the following?:
Col A Col B
$31.39 8.25%
$97.43 8.25%
$ 5.31 6.25%
What I'm trying to do is to create a formula where if Col B is 8.25% then sum Col A and divide by 1.0825, and if Col B is 6.25% then sum Col A and divide by 1.0625. Please help. Thank you!
Hi,
Can some body help me to sum the top 10 or 15 values with multiple conditions
I have a sheet 1 with 12 tables, 1 for each month, each table has has 2 rows, engineer name and total repairs. sheet 2 (Raw Data) has a list of each repair over the year, I want to take data from this to show on sheet one how many repairs each engineer did each month. So I need a formula that will sum or count where John did 32 repairs in Jan etc, so I guess I need to set criteria to count if John, if greater than 01/01/15 if less than 31/01/15 but I can't, I triend Sumif, sumifs, countif, countifs, sumproduct, vlookup, I just get the #value error, I can get it to count engineers or dates in the entire raw data sheet but not together. Any Help would be appreciated, my formula is, =COUNTIFS('Raw Data'!A2:A1500, "176WS", 'Raw Data'!H2:H1564, ">=01/01/2015", 'Raw Data'!H2:H1564, "<=31/01/2015")
in the row A, we have the names of customer, and B we have their deposit. using Sumif comment we can calculate their individual deposit easily, in onother colomn.
How can I use this comment as same
I need the sum of deposits except to two guyz (ex: ramu and Raju) from that 10 persons list. how can use command
ilike this function
Hi,
I am using a SUMIF formula against two columns (column 1 = customer name, column 2 = fees due), that adds the total fees due for a customer. I would like to be able to have my SUMIF formula in the third column and be able to drag fill the formula down the column without duplicate values appearing for the same customer. What would I need to add to my formula for this happen?
Thanks.
This is very good with understable examples..thanks a ton
Hi,
If I want to add all values in comum Q12:Q500 based on the date on column T12:T500 but also if the text matches to a certain criteria.
I have 30 associates and I want to separate in a date range by criteria.
I have this in my spreadsheet counting all without dates but I need to separate by date and criteria
=SUMIF(S:S,"CRITICAL",Q:Q)
"q" is the total criticals but I want to separate by date range on column "T" which has three different criterias
"Critical"
"Major"
"Minor"
can you help?
Very helpful - thank you!!!!
Hi,
I want use the formula for to get sum of column F:F as against
=SUMIFS($F:$F,$A:$A,$B$4:$B$101,$B:$B,$A4)
Here Critera1 is the range($B$4:$B$10)of anather sheet
not a single value , how can I modify the formula to get the sum
Here Critera1 is the range($B$4:$B$10)of another sheet
Here Critera1 is the range($B$4:$B$10)in of another sheet
Hi,
I want use the formula for to get sum of column F:F as against
=SUMIFS($F:$F,$A:$A,$B$4:$B$101,$B:$B,$A4)
Here Critera1 is the range($B$4:$B$10)
not a single value , how can I modify the formula to get the sum
Thanks & Regards,
Giri
Hi,
I would like to sum column D, providing that certain criteria are met. One of my criteria reference values in a range of cells.
Here is my formula,
=SUM(SUMIFS($E$4:$E$28,$B$4:$B$28,{50861394,50861765,50861767},$C$4:$C$28,I30))
could you please help me to use the range D1:D3 instead of typeing the values like{50861394,50861765,50861767}
Svetlana - this is fantastic. I bought Ablebits a while ago for several of the functions and I love this additional help!
I've been wanting to convert an investment tracking sheet from simple formulas that are time consuming to reproduce each cycle to advanced/array formulas that will do the heavy lifting each time once I give it the new data.
As such - this information, especially the SUM and SUMIF Array Argument, helped a great deal.
However, when I reproduced the array but changed SUM to AVERAGE and SUMIF to AVERAGEIF, it does not produce the correct average result. I know this as I worked it out the old way to make sure. I couldn't find a separate entry on AVERAGEIF/AVERAGEIFS, so I thought I'd ask here!
It also doesn't like it if I do COUNT/COUNTIF, too.
-Bret
Hi Bret,
Thank you for choosing Ablebits add-ins! As for AVERAGEIF/AVERAGEIFS, you read my mind - I'm working on this tutorial at the moment :)
If you can send us (support@ablebits.com) your sample workbook along with the expected result and we will try to figure out a proper formula.
Thank you, Svetlana! I just sent that to you.
Hi can you help me out with one of the figures
I have perticular set of alphabet numbers but each number carrying different colours , i want sort the colours with the diff numbers and required count
I would like to give sumif function for more than two citeria on the same cell
Example
150/48 R.Blue Int.
150/48 Int. T. Blue
150/36 Int. R. Blue
150/48 Int. C. Brown
150/48 R.Blue Int.
150/48 Int. C. Brown
Formular: i want to sum the total of R.Blue for 150/48 and 150/36
=IF(D7="","",SUMIF(Table,D7&"*",kgs)+SUMIF(Table,E7&"*",kgs)+SUMIF(Table,F7&"*",kgs)+SUMIF(Table,C7&"*",kgs))
giving sumif function for more than one citeria on one cell of text.
Regards
I would like to give sumif function for more than two citeria on the same cell
Example
150/48 R.Blue Int. 1
150/48 Int. T. Blue 2
150/36 Int. R. Blue 3 -----result
150/48 Int. C. Brown 4
150/48 R.Blue Int. 5
150/48 Int. C. Brown 6
Formular: i want to sum the total of R.Blue for 150/48 and 150/36
=SUMIF(C4:C9,"*"&150/36&"*"&"*""R.Blue"*"",D4:D9) but no result, but it should be 3
giving sumif function for more than one citeria on one cell of text.
Dear Svetlana,
thank you very much for posting useful information regarding use of SUMIFS function.
Basir
from Afghanistan
I use excel to export my collection data (med billing)and would like a formula to compare the cells to find matching account numbers, add their balances together (collection agency only takes accounts over $10)and give me a total in the cell of my choice. Some accounts range from 1 charge to multiple and it would be easier to look in one box instead of adding 10 lines to see if it's over(or under). I have looked at some of the formulas but nothing seems to fit.
Thank you
Светлана, я просто хочу вам сказать, что у вас прекрасный блог - лучшее из того, что я встречал в Интернет по теме Excel, и еще у вас прекрасный английский.
Спасибо большое! Мне очень приятно что наш блог читают и соотечественники :)
Svetlana,
First, thanks for the very long post, and for the many responses to comments. I am a little stuck on one of the formulas you provided, in "How to use SUMIFS in Excel - formula examples," specifically, in example two, where you use the TODAY formula. I tried to tweak it like this:
=SUMIFS(E3:E1000,D3:D1000,"="&MONTH(A2),D3:D1000,"="&YEAR(A2))
This is a sample of what my data looks like (column C is empty, and column B is where I'm pasting my formula):
A, B, D, E
Month-End Date, Month-End Total Fees, Date Fee Assessed, Amount of Fee
11/30/2014, [formula - should equal $9.00], 11/15/2014, $5.00
12/31/2014, [formula - should equal $1.00], 11/21/2014, $4.00
01/31/2015, [formula - should equal $0.00], 12/03/2014, $1.00
02/28/2015, [formula - should equal $2.00], 02/05/2015, $2.00
In column A, each month will only show up once, but in column D, it might show up many times, or never.
I am simply getting zero in all cells in column B.
Thank you for any help you can give.
Robert
I figured something out. Thought I would share it here:
=SUMPRODUCT(--(YEAR(D$3:D$10000)=YEAR(A3)),--(MONTH(D$3:D$10000)=MONTH(A3)),(G$3:G$10000))
I know it's not a SUMIF function, but in case anyone was heading down the wrong path, like I was, it might help. And no, I don't know how it works. I adapted it from #6 in this thread: https://www.mrexcel.com/forum/excel-questions/613222-use-formula-sumifs-criteria-range.html, using trial and error. Sorry if this is not kosher, to post a link to another site.
Robert
What will be the formula in above example,
If I want a sum of Qty for criteria ;
Product = Apple and/or Product = Banana
Supplier = John
Hi Pradeep,
In this case, you can add up 2 SUMIFS functions:
=SUMIFS(C2:C9, A2:A9, "apple", B2:B9, "John") + SUMIFS(C2:C9, A2:A9, "banana", B2:B9, "John")
Thanks Svetlana for quick reply,
So does that mean we can give 2 criteria for single column in a single function ?
Pradeep,
In this particular example, we add up 2 different SUMIFS functions because you want a formula to work with the OR logic.
Yes, you can supply 2 criteria for a single column in a single function, but they will work with the AND logic. For example, the following formula sums values in A2:A11 that are greater than 5 AND less than 10:
=SUMIFS(A2:A11, A2:A11, ">5", A2:A11, "<10")
I tried using the formula as show in Example 3, sumproducts & sumifs, but the formula is giving me the sum of everything except what I asked it to sum. Also, it doesn't sum the data on the top row. I'm very puzzled!
Please help.
Thank You,
Hi Richard,
It'd difficult to detect the source of the problem without seeing your data. If you can send your sample workbook with the formula to our support team at support@ablebits.com, we will try to help.
SKU QTY.
LM200 156
LM100 84
LM25 57
LM10 4
EG200 14
EG100 17
EG25 10
EG10 3
DJ200 41
DJ100 2
DJ25 0
CLA200 19
CLA100 98
CLA25 32
EBF200 41
EBF100 36
EBF25 33
ELC25 2
GT200 232
GT100 125
GT25 63
GT10 1
GEg25 42
GJas25 90
GM25 62
GM10 1
GTL100 61
GTL25 56
GTL10 1
LG25 6
GLH25 21
DIG25 0
OMC25 0
SM25 0
CAM25 0
PPM25 0
LR25 0
TinDG100g 0
TinDR100g 0
TinAS100g 0
RITUAL 0
09CB100 0
12CB100 0
Hi.
my question is how can sum value against if name is duplicate in a column.pls suggest.