Sum with multiple Sum ranges for criteria in multiple criteria ranges - excel

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..

Related

Combine two lists in Excel, one underneath the other

I have two lists of products in Excel. Each list will be of varying length each month.
Is there a way to combine the two lists into a third list, with the second list being underneath the first?
I would like to do this avoiding macros.
I image this could be done using Dynamic Arrays, but I can't figure it out.
Please see an example below:
Thank you so much in advance.
I have had this problem before and used this tutorial to help me. I attach the example sheet also, which provides the formula that may work for your problem.
See the image below for cell references - then try this:
=IFERROR(INDEX($B$3:$B$7, ROWS(H2:$H$2)), IFERROR(INDEX($D$3:$D$4, ROWS(H2:$H$2)-ROWS($B$3:$B$7)), IFERROR(INDEX($F$3:$F$6, ROWS(H2:$H$2)-ROWS($B$3:$B$7)-ROWS($D$3:$D$4)), "")))
I have managed to find a solution that works for me, where the lists are of variable length.
Using a similar scenario to Mardi-Louise's answer, I am using the following formula in cell F3, and then dragging down:
=IF(B3<>"",B3,OFFSET($D$3,ROW()-COUNTA($B$3:$B$7),0))
Explanation:
So long as List 1 is not finished, it takes the value from List 1.
Once List 1 is finished, it begins at the top of List 2, and uses an offset to move down.
I'm late to the party, but for anyone still looking for this there's (now) a function for this in Excel 365: vstack(array1;array2;...)
Here is Microsoft's page on it
With the arrays as columns in tables you'll get dynamic lengths. It's also possible to combine vstack() with for example unique().
I benefitted from Answer 2 with slightly different syntax. The ROW() function provides an output based on the absolute cell address when an output based on the relative position of the list is actually more generally applicable. I found the following syntax works better to reference the output of ROW() to the cell above the top cell of range D3:D8:
=IF(B3<>"",B3,OFFSET($D$2,ROW()-ROW($D$2)-COUNTA($B$3:$B$7),0))
Additionally, the COUNTA function can provide inconsistent results when cells in the range are not based on simple data but on the output of formulas which can be equal to 0 or blank without actually being empty. In that case COUNTIF often works better such as:
=IF(B3<>"",B3,OFFSET($D$2,ROW()-ROW($D$2)-COUNTIF($B$3:$B$7,"<>"&0),0))

Excel Sumif formula

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 :)

How can I use COUNTIFS for multiple criteria?

I want to be able to use the COUNTIFS formula for multiple criteria.
For example:
1,Banana
2,Orange
1,Banana
2,Orange
I want to use COUNTIFS to count how many occurrences of 1 is associated with banana and how many times 2 is associated with orange.
I'm thinking of =COUNTIFS(A:A,1,B:B,"Banana")+=COUNTIFS(A:A,2,B:B,"Orange")
This would supposedly equal 4, but I know that formula is wrong and I don't know how to format it.
If this is not possible, then I'd have to use two of the same formulas and add them together, but I'm looking for a better way and just use one formula.
How do I go about this problem, any help would be greatly appreciated.
Thank you.
EDIT: =COUNTIFS(A:A,1,B:B,"Banana",A:A,2,B:B,"Orange") returns 0 for some reason, why is that?
You can try SUMPRODUCT function instead:
=SUMPRODUCT(((B:B="Orange")+(B:B="Banana"))*(A:A=1))
To add additional criteria value, you need to add it to the rest, for example - adding Apples criteria:
=SUMPRODUCT(((B:B="Orange")+(B:B="Banana")+(B:B="Apple"))*(A:A=1))
Similar logic needs to be used to add another criteria range, for example:
=SUMPRODUCT(((B:B="Orange")+(B:B="Banana"))(A:A=1)(C:C="X"))
Hope it helped.
EDIT: Just saw question adjustment. In that case you should use following logic:
=SUMPRODUCT((B:B="Orange")(A:A=1)+(B:B="Banana")(A:A=2))
your formula should be
=COUNTIFS(A:A,1,B:B,"Banana")+COUNTIFS(A:A,2,B:B,"Orange")

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.

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