Excel Sumif formula - excel

I am trying to create a SumIf formula that adds multiple columns together based on one criteria.
=sumif(F$8:F$58,F73,L$8:L$58+I$8:I$58)
This is giving me an error and will not add the two columns together.

You'd need
=sumif(F$8:F$58,F73,L$8:L$58) + sumif(F$8:F$58,F73,I$8:I$58)

I highly recommend you make it a practice to use SUMIFS instead of SUMIF even if you only have one criteria. The order makes more sense (what you're summing first), and it scales easier. Say you want to start adding more criteria, now you'll have to readjust the order of the inputs, whereas with Sumifs you simply just add to the criteria.
=sumifs(L$8:L$58,F$8:F$58,F73) + sumifs(I$8:I$58,F$8:F$58,F73)

In case of summing multiple ranges, you can also try SUMPRODUCT
=SUMPRODUCT((F$8:F$58=F73)*((L$8:L$58)+(I$8:I$58)))
The logic is similar to SUMIFS, (F$8:F$58=F73) sets the criteria while ((L$8:L$58)+(I$8:I$58)) defines the range to be summed.
Let me know if you have any questions. Cheers :)

Related

Sum with multiple Sum ranges for criteria in multiple criteria ranges

I need to sum using more than one sum range for a criteria matching in more than on criteria range.
Sample:
I have tried searching solution to me problem but couldn't find.
I am not sure how should I be asking related question here, I am just attaching an image just i did earlier.
enter image description here
SUMIFS requires that the ranges be the same size so you can do:
=SUMIFS(B:D,A:C,G2)
Or you can add two SUMIFS together:
=SUMIFS(B:B,A:A,G2)+SUMIFS(D:D,C:C,G2)
Finally I was able to achieve solution to the situation,
solution:
=SUM(IF(A1:C6=H2,IF(E1:E6=H3,B1:D6)))
Regards..

How to COUNTIF two sets of criteria are correct (likely easy)

Firstly, there are a few (2) threads with /similar/ questions but they have very different criteria and are too complicated to be understood. I apologize if this is a dumb question. Also note: I need this to be a formula, not VBA, if possible. This is because I have to be able to share it with staff who have never used VBA and I need them to have a good understanding of the base functions (such as adjusting ranges, criteria, etc.).
I am trying to use a formula to count cells that meet two sets of criteria.
So essentially, I want a formula that says "if column C is = Closed and column B = January, count it."
This is similar to "=COUNTIF('Data Sheet'!C:C,"Closed")" but with added criteria.
It is essential that it meets both sets of criteria and only counts those cases. The correct total for the example would be 3.
Thank you for your help!
Adjust the ranges, and 'Closed' / 'January' criteria as needed.
=COUNTIFS(C1:C4,"Closed",B1:B4,"January")

Excel - SUMIFS for multiple columns

I need to sum the values of several columns, if other cells in the same row match a predefined criteria. The working formula for only 3 columns is the following:
=SUM(SUMIFS(‘Sheet1'!W:W; ‘Sheet1'!$B:$B;"Sales";‘Sheet1'!$C:$C;">=4");SUMIFS(‘Sheet1'!X:X; ‘Sheet1'!$B:$B;"Sales";‘Sheet1'!$C:$C;">=4");SUMIFS(‘Sheet1'!Y:Y; ‘Sheet1'!$B:$B;"Sales";‘Sheet1'!$C:$C;">=4"))
I will need to use the formula for several cells (and sum more than 10 columns per time) and I will need to change the columns manually, so I need the same formula in the following way:
=SUMIFS(‘Sheet1'!W:Y; ‘Sheet1'!$B:$B;"Sales";‘Sheet1'!$C:$C;">=4")
,but currently this formula leads to a "#VALUE!" error. The reason for that is (I assume) the use of multiple columns "W:Y"
Can you suggest a workaround?
I would suggest to use SUMPRODUCT rather than SUMIFS. You can build something like that :
=SUMPRODUCT((B1:B1048575="Sales")*(C1:C1048575>=4)*(W1:Y1048575))
The downside of SUMPRODUCT is that you can't use a whole column (for example you cannot write SUMPRODUCT((B:B="Sales"...)), this would generate an error).
Hope this helps.
I suggest you add a column with the sum('sheet1'!W:Y) and then use sumifs on this columns. It is a two step way but it will give the result you expect
Here's what I have :)
=SUM(SUMIFS('WTD Raw'!R:R,'WTD Raw'!E:E,"Kindle-Customer Care",'WTD
Raw'!J:J,"Week27",'WTD Raw'!H:H,'PassRate | July'!G8) + SUMIFS('WTD
Raw'!R:R,'WTD
Raw'!E:E,"Kindle-Technical Support",'WTD Raw'!J:J,"Week27",'WTD
Raw'!H:H,'PassRate | July'!G8))
Instead of using ";" use the Mathematical Operators for it to work.

Using SUMIFS with multiple AND OR conditions

I would like to create a succinct Excel formula that SUMS a column based on a set of AND conditions, plus a set of OR conditions.
My Excel table contains the following data and I used defined names for the columns.
Quote_Value (Worksheet!$A:$A) holds an accounting value.
Days_To_Close (Worksheet!$B:$B) contains a formula that results in a number.
Salesman (Worksheet!$C:$C) contains text and is a name.
Quote_Month (Worksheet!$D:$D) contains a formula (=TEXT(Worksheet!$E:$E,"mmm-yy"))to convert a date/time number from another column into a text based month reference.
I want to SUM Quote_Value if Salesman equals JBloggs and Days_To_Close is equal to or less than 90 and Quote_Month is equal to one of the following (Oct-13, Nov-13, or Dec-13).
At the moment, I've got this to work but it includes a lot of repetition, which I don't think I need.
=SUM(SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Oct-13")+SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Nov-13")+SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Dec-13"))
What I'd like to do is something more like the following but I can't work out the correct syntax:
=SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,OR(Quote_Month="Oct-13",Quote_Month="Nov-13",Quote_Month="Dec-13"))
That formula doesn't error, it just returns a 0 value. Yet if I manually examine the data, that's not correct. I even tried using TRIM(Quote_Month) to make sure that spaces hadn't crept into the data but the fact that my extended SUM formula works indicates that the data is OK and that it's a syntax issue. Can anybody steer me in the right direction?
You can use SUMIFS like this
=SUM(SUMIFS(Quote_Value,Salesman,"JBloggs",Days_To_Close,"<=90",Quote_Month,{"Oct-13","Nov-13","Dec-13"}))
The SUMIFS function will return an "array" of 3 values (one total each for "Oct-13", "Nov-13" and "Dec-13"), so you need SUM to sum that array and give you the final result.
Be careful with this syntax, you can only have at most two criteria within the formula with "OR" conditions...and if there are two then in one you must separate the criteria with commas, in the other with semi-colons.
If you need more you might use SUMPRODUCT with MATCH, e.g. in your case
=SUMPRODUCT(Quote_Value,(Salesman="JBloggs")*(Days_To_Close<=90)*ISNUMBER(MATCH(Quote_Month,{"Oct-13","Nov-13","Dec-13"},0)))
In that version you can add any number of "OR" criteria using ISNUMBER/MATCH
You can use DSUM, which will be more flexible. Like if you want to change the name of Salesman or the Quote Month, you need not change the formula, but only some criteria cells. Please see the link below for details...Even the criteria can be formula to copied from other sheets
http://office.microsoft.com/en-us/excel-help/dsum-function-HP010342460.aspx?CTT=1
You might consider referencing the actual date/time in the source column for Quote_Month, then you could transform your OR into a couple of ANDs, something like (assuing the date's in something I've chosen to call Quote_Date)
=SUMIFS(Quote_Value,"<=90",Quote_Date,">="&DATE(2013,11,1),Quote_Date,"<="&DATE(2013,12,31),Salesman,"=JBloggs",Days_To_Close)
(I moved the interesting conditions to the front).
This approach works here because that "OR" condition is actually specifying a date range - it might not work in other cases.
Quote_Month (Worksheet!$D:$D) contains a formula (=TEXT(Worksheet!$E:$E,"mmm-yy"))to convert a date/time number from another column into a text based month reference.
You can use OR by adding + in Sumproduct. See this
=SUMPRODUCT((Quote_Value)*(Salesman="JBloggs")*(Days_To_Close<=90)*((Quote_Month="Cond1")+(Quote_Month="Cond2")+(Quote_Month="Cond3")))
ScreenShot
Speed
SUMPRODUCT is faster than SUM arrays, i.e. having {} arrays in the SUM function. SUMIFS is 30% faster than SUMPRODUCT.
{SUM(SUMIFS({}))} vs SUMPRODUCT(SUMIFS({})) both works fine, but SUMPRODUCT feels a bit easier to write without the CTRL-SHIFT-ENTER to create the {}.
Preference
I personally prefer writing SUMPRODUCT(--(ISNUMBER(MATCH(...)))) over SUMPRODUCT(SUMIFS({})) for multiple criteria.
However, if you have a drop-down menu where you want to select specific characteristics or all, SUMPRODUCT(SUMIFS()), is the only way to go. (as for selecting "all", the value should enter in "<>" + "Whatever word you want as long as it's not part of the specific characteristics".
In order to get the formula to work place the cursor inside the formula and press ctr+shift+enter and then it will work!
With the following, it is easy to link the Cell address...
=SUM(SUMIFS(FAGLL03!$I$4:$I$1048576,FAGLL03!$A$4:$A$1048576,">="&INDIRECT("A"&ROW()),FAGLL03!$A$4:$A$1048576,"<="&INDIRECT("B"&ROW()),FAGLL03!$Q$4:$Q$1048576,E$2))
Can use address / substitute / Column functions as required to use Cell addresses in full DYNAMIC.

Cross table comparisons, sumproduct

I am trying to compare two different Excel (2010/xlsx) tables with related data to find matches. They would be on different sheets but in the same workbook (not that it should affect the problem).
I think the best route is some combination of sumproduct, match, and index... but I haven't been able to get them to work so far. I see the main question (cell G17) being solved by creating a subset of rows from Table 2 to compare against their corresponding data in Table 1 (index/match), then using arrays to do a multiple criteria selection to count how many match the criteria I chose (sumproduct).
I have played around with vlookup, countif(s), and sumif(s) but haven't seen a good way to apply them to this problem.
You can use SUMIF as a "quasi-lookup" like this
=SUMPRODUCT((file="doc")*(modified < SUMIF(user,creator,create)))
I'm not sure how to do it in a single cell as you've asked, but I would create an extra column in the second table which uses vlookup to find the created date, and another column containing whether or not the created date is greater than the modified date. Finally, you could use countif to combine them.
To be more concrete, in your example, I would put =vlookup(F3,A$3:D$5,2,FALSE) in cell I3, and =I3>H3 into cell J3, and expand both of these down. Then cell G17 could be given by =countif(J3:J5,TRUE).

Resources