Sumif vs Sumifs in Excel - excel-formula

here is my understanding on sum functions:
Sumifs do not accept multiple columns in sum_range but Sumif do, is that correct?
if it is, could you please suggest an alternative to include multiple columns for sum range. Thanks!

No. SUMIFS only allow a sum of one column, much like SUMIF.
The difference is in the number of criteria ranges.
In a SUMIFS, you would say
=SUMIFS(sum range, criteria range 1, criteria 1, criteria range 2, criteria 2, ...)
If you want to sum multiple columns, you can add multiple SUMIFSes:
=SUMIFS(...) + SUMIFS(...) + SUMIFS(...)

Related

Multiple SUMIFS

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

countifs same criteria in diffrent criteria ranges

Need to countifs values between two dates and need to lookup same criteria in different criteria ranges (columns I,J,K) values.I used below formula in N6.Answer should 3.between given dates how many rows are common for given line no in(M4) between given start and end date.Please advise.
=COUNTIFS(A2:A7,">="&N2,A2:A7,"<="&N3,H2:H7,"PASS",I2:I7,M4,J2:J7,M4,K2:K7,M4)
As long as 33A occurs just once in columns I-K you could use:
=SUMPRODUCT((A2:A7>=N2)*(A2:A7<=N3)*(H2:H7="PASS")*(I2:K7=M4))

Countifs does not work when a range with multiple column is selected

I need a count if function that counts me the cells that meet a certain criteria. This should be done with countifs. The formula is the following:
=COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!K:Q;">=1")This formula returns me an value type error.
This formula works well until I introduce the last condition orders!K:Q;">=1"
I would like a formula that counts if the word Ecolab is present in the cell; if the date is after or equal 01/01/2019; if the column U has more or equal than the number 36 and if there is at least a "1" in the cells in the row from column K to column Q. I could do this by easily replicating the countifs several times, (i.e =COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!K:K;">=1")+COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!L:L;">=1")+...........+COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!Q:Q;">=1")
But I would rather not include such a long formula as it would create confusion for the ultimate user of the excel sheet
Per my comment above, you could use SUMPRODUCT (avoid using whole columns for that) or an array with OFFSET like this:
=SUM(COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";OFFSET(Orders!J:J;0;{1;2;3;4;5;6;7});">=1"))
If the count for K:Q should be 1 when there may be more than one cell greater or equal to 1 in a single row then you need to apply OR criteria in a SUMPRODUCT.
SUMPRODUCT formulas should not use full column references; there is too much wasted calculation. The following is for rows 2:99; adjust for your own use.
=SUMPRODUCT(--ISNUMBER(SEARCH("ecolab", Orders!D2:D99)),
--(Orders!B2:B99>=DATE(2019, 1, 1)),
--(Orders!U2:U99>=36),
SIGN((Orders!K2:K99>=1)+(Orders!L2:L99>=1)+(Orders!M2:M99>=1)+(Orders!N2:N99>=1)+(Orders!O2:O99>=1)+(Orders!P2:P99>=1)+(Orders!Q2:Q99>=1)))

Excel SumIF with range as Column and Sum range as ROW

I am trying to make this work:
=SUMIF(MATRIX!$B$2:$B$36,"YES",B5:AJ5)
Note that the range is a COLUMN and the sum range is a ROW but when the formula computes it doesn't sum the Row B5:AJ5 it actually sums B5:B40. What do I need to add to have it sum the ROW and not the COLUMN.
EXAMPLE:
As you have discovered, a SUMIF expects both the criteria array and the sum array to be both rows or columns but not one of each. You have correctly used the same number of cells in each; the problem is that they are in different directions. A TRANSPOSE function can reverse the direction that the outer function 'sees' the one of the arrays but you need to change from SUMIF to SUMPRODUCT and enter it as an array formula with Ctrl+Shift+Enter.
=SUMPRODUCT((B$2:B$5="yes")*(TRANSPOSE($H2:$K2)))
When entered correctly with CSE, the result in L2 is 2.3. Fill both right and down for something resembling the following.
I don't believe you can use transpose with SUMIF but someone might know a trick to it.

Sumif Formula with no duplicates

I am trying to have sumif formula which avoid duplicates. For example if something has been summed in the above rows, I don’t want it to be summed again if it’s down in the below rows, can you please assist?
=SUMIF($R$50:$R$54,R50,$AG$50:$AG$54)
Thanks
Are you able to add another column for additional criteria?
For example, if you add another column (let's say it's in column A) with the formula
=IF(COUNTIF($R$50:R50,R50)=1,1,0)
The formula above will return a 1 if the value in Cell R50 is unique, and a 0 if it is not. Now change your SumIf function to SumIfs. You could use
=SUMIFS($AG$50:$AG$54,$R$50:$R$54,R50,$A$50:$A$54,1)
to return the sum of only unique values.
The SumIfs function is pretty much a SumIf function, but with the ability to use multiple criteria without the need for an array function. SumIf criteria is SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...), so we are returning the sum of all values in AG50:AG54 where the value in R50:R54 matches that of R50 AND the unique flag in A50:A54 equals 1.
Edit
I should clarify that the SUMIFS formula isn't available in Office 2003 and below. If this means you cannot use SUMIFS, I believe you will need an array formula, let me know.
=IF($R84=$R83,"",SUMIFS($AG:$AG,$R:$R,$R84,$S:$S,$S84))

Resources