Multiple SUMIFS - excel

here is my formula I am currently working on: =SUMIFS(Leuf!G2:G1705, Leuf!D2:D1705, "January", Leuf!J2:J1705)
here is the sample data:
[1]: https://i.stack.imgur.com/NWEXd.png
I am trying to calculate the total gallons based on the month in column F and also the column D as there are two different options "Clear Led" and "Dyed." I need to separate the cost but my current formula will not work.

Try This -
=Sumifs("Sum Range", Criteria Range 1, Criteria, Criteria Range 2, Criteria)
In your case formula should be
=sumifs(j:j,G:G,"January",D:D,"Clear LED")

Related

How to convert the data following into range on excel?

I have data like following:
If I want it to convert it into specific ranges like following:
How should I do it on excel?
As Foxfire And Burns And Burns has mentioned, it is best to use a PIVOT TABLES and then Group it by intervals of 50. Using Pivot Tables and then Group & Ungroup is pretty easy and highly suggested by all excel experts in this community.
However if you are looking to use a formula to create that range (RAFFLE TICKET) that's how its known, then you may try the formula mentioned below,
Formula used in cell A2
=(ROWS($A$2:A2)-1)*50&"-"&ROWS($A$2:A2)*50
And Fill Down!
For those using Excel 2021 & O365, may try this one as well
=SEQUENCE(11,,0,50)&"-"&SEQUENCE(11,,50,50)
Next to get the total counts you can use SUMPRODUCT FUNCTION, which creates an array of TRUE's & FALSE's & multiplies the same with the corresponding ranges accordingly, so the formula used in cell B2
=SUMPRODUCT(($E$2:$E$16>=--LEFT(A2,FIND("-",A2)-1))*($E$2:$E$16<=--RIGHT(A2,LEN(A2)-FIND("-",A2)))*$F$2:$F$16)
And Fill Down!
I suggest you to create the Dummy column (C column) which will contain the limits of your ranges. And then you will fill values into the D column thanks to this formula :
=C2 & "-" & C3
So the first value Total Count column can be filled with (in column E) :
=SUMIF(A$2:A$16;"<"& C3;B$2:B$16)-SUMIF(A$2:A$16;"<"&C2;B$2:B$16)
and then you can extend the formula through the other cells of the column.
This SUMIF() formula calculates values for range <50 minus values for range <0 (for Range 0-50). For Range 50-100, this formula will calculate the sum for range <100 minus sum for range <50, and so on..
The
Remark : Here the limits of the range are not considered for example if Valeur =50 the formula in Range column doen't count it. If you want to consider them in account, you can modify the values of the Dummy column to 0; 49.999999; or 50.000001 (left for you as an exercice :) ).
I would advise you to create a helper column, using a formula like =ROUNDDOWN(A1,0).
Once you have this (let's say in column "C"), you can sum your values using the basic =SUMIF() function, something like:
=SUMIF(C$1:C$8,3,B$1:B$8)
(This will sum the values of the cells from B1 to B8, in case the corresponding values in column "C" are equal to 3, which means that the values in column "A" are between 150 and 199.99....

How can I vlookup across rows with title rows as criteria in Excel/VBA?

Example
Data:
Output:
Hello, please see attached sheet. I have sheets with financial data organized by an ID column and by date rows in titles.
On sheet 1, I want to specify a date range in sheet 1 cells B1 & D1 for which profit margin would be calculated. For example, given the images below, I need a formula in B3 of output that can sum the profit values from 2/1 to 2/6 (34).
Could anyone point me in the right direction as far as VBA or even some in sheet excel formulas? Appreciate any feedback
You can use MATCH to find the ID and Dates, and a series in INDEX 's to return the required range t o a SUM
=SUM( INDEX( Profit, IDRow, FromDateColumn) : INDEX( Profit, IDRow, ToDateColumn))
where FromDateColumn, ToDateColumn and IDRow are found with MATCH
=SUM(
INDEX(Profit!$1:$1048576, MATCH($A$3,Profit!$A:$A,0), MATCH($B$1,Profit!$1:$1,0)) :
INDEX(Profit!$1:$1048576, MATCH($A$3,Profit!$A:$A,0), MATCH($D$1,Profit!$1:$1,0)) )

Sumproduct between dates with additional criteria across columns

Im trying to put together a sumproduct formula that looks between two dates and has a criteria across columns.
I have the following:
Start Date:
Sheet1!A1
End Date:
Sheet1!A2
Criteria Field: Sheet1!A3
I want to sum columns Sheet2!B2:F200 where Sheet2!A2:A200 is between the Start and End dates on Sheet1 and where Sheet2!B1:F1 equal the criteria field from Sheet1
I made it to here but I'm not able to sum across columns or add in the criteria field.
SUMPRODUCT(--(Sheet2!A2:A200>=Sheet1!A1),--(Sheet2!A2:A200<=Sheet1!A2),Sheet2!C:C)
Use SUMIFS with INDEX to return the correct column:
=SUMIFS(INDEX(Sheet2!$B:$F,0,MATCH(Sheet1!A3,Sheet2!$B1:$F$1,0)),Sheet2!$A:$A,">=" & Sheet1!A1,Sheet2!$A:$A,"<=" & Sheet1!A2)

Sumproduct with mapping multiple rows and match through the rows

want to write excel formula that will sum the values based on a match of the rows. The cells to be matched can occur multiple times and basing on the Mapping legend they should return the sum of values.
In the yellow cells I am trying to calculate sum of values in range B9:B21 based on a match of the names in G3:G8 according to Mapping legend to Item1, then Item2 and Item 3. Also I want to consider the sum to be done across Date 1, Date 2 and Date 3. The SumProduct formula below works only
if I use it on sum array for a single date but not across date1 , date2 and date 3:
Does sombody know how to fix this?
I would like to add that I want to have the fomrula to be identical in each yellow cell without splitting the arrays across the dates. The more, it is important in the formula to have it on the basis that 'date 1', 'date2' and 'date3' are matched.
Put this array formula into B2 with CSE then fill right and down.
=SUM(SUMIFS(INDEX($B$8:$D$19, 0, MATCH(B$1, $B$7:$D$7, 0)), $A$8:$A$19, IF($F$2:$F$7=$A2, $G$2:$G$7)))

Count cells in a column that contain certain text only for a certain month

I am trying to count cells in column E that contain the word "Yelp" only for a certain month (January in this case).
As there will be a different number of new patients each month, I cannot set set a range limit e.g E4:E33. As this "E33" number will change, I would like it to be just E (entire column) so we don't have to change the formula manually each month.
I tried different variations of COUNTIFS(MONTH(D4:D), "=1", E4:E, "Yelp") but it doesn't work. Using something like "filter" would requires manually changing the formula each month so I can't use that.
This formula only counts how many times "Yelp" appears in a column
but isn't conditional on month.
Data I'm working with
Try this:
First add a column (let's say F) that returns the month of the date (D)
F1=MONTH(D1) (and drag it down)
Then, count:
=COUNTIFS(F:F;4;D:D;'Yelp');
That means: count only when month is 4 and source is Yelp
EDIT:
I assume you'd want to filter by year as well. In that case, add a column that returns the year:
G1=YEAR(D1) (and drag it down), and then:
=COUNTIFS(F:F;4;G:G;2018;D:D;'Yelp');
That means: count only when month is 4, year is 2018 and source is Yelp
EXPLANATION:
Syntax of COUNTIFS is:
COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]…)
The COUNTIFS function syntax has the following arguments:
criteria_range1 Required. The first range in which to evaluate the
associated criteria.
criteria1 Required. The criteria in the form of a number,
expression, cell reference, or text that define which cells will be
counted. For example, criteria can be expressed as 32, ">32", B4,
"apples", or "32".
criteria_range2, criteria2, ... Optional. Additional ranges and
their associated criteria. Up to 127 range/criteria pairs are allowed.
From: https://support.office.com/en-us/article/countifs-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842
Try,
=sumproduct((month(d4:d999)=1)*(e4:e999="yelp"))
'alternate with fully dynamic ranges
=sumproduct((month(d4:index(d:d, match(1e99, d:d)))=1)*(e4:index(e:e, match(1e99, d:d))="yelp"))
Avoid full column references with SUMPRODUCT.

Resources