I have a data set like this (not table):
I want to Sum with following criteria: US, Apple and date prior to today.
Because of the data layout the SUMIFS formula doesn't seems to work.
This is what I have:
=SUMIFS(C2:G3,A2:A3,"US",B2:B3,"Apple",A3:G3,"<"&Today())
SUMIFS requires all the ranges to be the same size and shape. you will want SUMPRODUCT:
=SUMPRODUCT(C2:G3*(A2:A3="US")*(B2:B3="Apple")*($C$1:$G$1<Today()))
Related
I have a list of values in a column and list of dates in another
I am trying to get the counts of values for different period of dates
What would be the ideal way to approach this
Your example seems incorrect -> the count "Moved between April and May" should be 0.
You need a COUNTIFS() function.
In your example use in cell B18:
=COUNTIFS(A2:A10;">="&DATE(2022;4;1);A2:A10;"<"&DATE(2022;5;1);B2:B10;"Moved")
In cell B20:
=COUNTIFS(A2:A10;">="&DATE(2022;2;1);A2:A10;"<"&DATE(2022;3;1);B2:B10;"Deleted")
I would put the criteria for the Countifs in separate cells so you can reference them. That is more flexible.
Can a countifs range be dynamic?
I'm simply trying to do a countifs formula in a worksheet that is likely to grow, currently I have the upper bound set to 10000 but since I'm trying to count the number of instances a date appears in a list I have to have a countif formula for every single day of the year. Thats 365 countif formulas all with an upper bound of 10000 and I'm sure at some point in a few months I will have to update it.
Am I able to use Excel formulas much like I could in VBA to declare a dynamic range for my countifs function?
If you convert your cell range to a table (select your table then Insert > Table) you can refer to the entire column or row with your formula and it will adapt dynamically.
Requirement :
->green color cell need sumproduct of cells where 90% found in 1st Column with its activity wtg.
->pink color cell need sumproduct of cells where 95% found in 2nd Column with its activity wtg.
->blue cell need sumproduct of cells where 100% found in 3rd Column with its activity wtg.
Just an extract pasted here, need a dynamic formula to use it in a large data table.
Thanks in advance.
You can use SUMPRODUCT() like below formula then drag across as you need.
=SUMPRODUCT(($A$3:$A$7)*(B3:B7=B1))
You can also use SUMIFS() like
=SUMIFS($A$3:$A$7,B3:B7,B1)
I already viewed the posting about summing values based on first occurrence in another cell but I would like to add a complication and nestle in a subtotal function. Basically I would like to sum values in the Score column based upon the first and only instance of a value in Color with subtotal filtering via one formula.
There are two formulas that somewhat give me the two components required but I'm limited in my formulaic abilities to combine these:
Sum values based on first occurrence in another column:
=SUMPRODUCT(B2:B8/COUNTIF(A2:A8,A2:A8))
Subtotal with sumproduct:
=SUMPRODUCT(B2:B8,SUBTOTAL(9,OFFSET(C2:C8,ROW(C2:C8)-MIN(ROW(C2:C8)),0,1)))
Unfiltered Table
Filtered Table
Any ideas?
Many thanks in advance
You can combine both formulas as below:
=SUMPRODUCT(B2:B8/COUNTIF(A2:A8,A2:A8),SUBTOTAL(3,OFFSET(A2:A8,ROW(A2:A8)-MIN(ROW(A2:A8)),0,1)))
The first part of the above formula is from your SUMPRODUCT formula so it is easy to understand, the second part of the formula should be using 3 - COUNT for the SUBTOTAL formula so it will return 1 for values showing in the filtered range and 0 for values that are not.
Let me know if you have any questions. Cheers :)
Hi I have store numbers in different columns and products in rows with sales for respective stores. I want to do sumif in a different sheet by changing stores and products in data validated cells. How do I select dynamic columns in Sumif based on store numbers. Attaching image for reference.
Here's a mockup based on your sample data, with row numbers and column letters shown:
Using that as a base, in cell C15 is this formula:
=SUMIF($C$3:$C$9,$C$14,INDEX($D$3:$G$9,0,MATCH($C$13,$D$2:$G$2,0)))
You'll need to adjust the ranges to suit your actual data.
=SUMIF(A2:A6,"=Shirts",B2:B6)
A2:A6 - This is the range over which the condition applies
"=Shirts" - the conditional expression.
B2:B6 - The cells under consideration for summing up.