My SUMIFS formula gets its criteria from a drop down filter. Need to be able sum all values IF the filter is left blank.
=SUMIFS(Data!AX:AX,Data!J:J,B2)
Use an IF function to determine whether the criteria cell is blank, and if it is, use a "regular" SUM function.
Something like,
=IF(B2="",SUM(Data!AX:AX),SUMIFS(Data!AX:AX,Data!J:J,B2))
Related
I want to store the multiple criteria of a SUMIFS function in a single cell with each individual criteria separated by a comma.
I realize you can do this by having each criteria in a separate cell, but I need to have each criteria in a single cell separated by commas (or some other delimiter).
The closest I've gotten is seen in the screenshot below. Cell E4 is the formula if I hard code the criteria (an account of 500 or 600). However, if I put those criteria in the criteria cell, E2, and reference the E2's value/contents through the CELL function, it returns the value "500","600" as """500"",""600""" because it escapes the double quotes and then interprets the value as a text string rather than a list of texts.
Does anyone know how to make cell E2's value be a list of text/strings so that it can be passed into the SUMIFS criteria parameter?
Does it need to be SUMIFS?
If you format E2 as text then input 500,600 you can use this formula for the sum
=SUMPRODUCT(ISNUMBER(SEARCH(","&B2:B8&",",","&E2&","))+0,C2:C8)
See screenshot
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.
I've been using Excel's COUNTIFS function to count the number of rows in a table that meet certain criteria, E.g:
=COUNTIFS(Table1[Result],"Fail", Table1[Comments], "")
Now I want to modify this expression so that it only counts rows in Table1 that are visible. (I.E. Not filtered out.) How can I accomplish this?
Simple way is to add another column to table - e.g. called helper with a formula like this
=SUBTOTAL(103, B2)
where column B is Result column
Now change formula to
=COUNTIFS(Table1[Result],"Fail", Table1[Comments], "",Table1[Helper],1)
the subtotal formula only returns 1 on visible rows
Without a helper column you can use this formula
=SUMPRODUCT((Table1[Result]="Fail")*(Table1[Comments]=""),SUBTOTAL(103,OFFSET(Table1[Result],ROW(Table1[Result])-MIN(ROW(Table1[Result])),0,1,1)))
I use this formula:
=subtotal(3,B2:B100)
where subtotal(3, that is CountA and
B2:b100 is the range.
The hidden rows in a filter are ignored and this formula only counts the visible rows.
It works for me and hope it works for you
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))
Say I have to sum up the cells in column B if their corresponding cells in column A <= the value in some specific cell in column C. Instead of SUMIF(A1:A10,"<=10",B1:B10), I tried SUMIF(A1:A10,"<=C1",B1:B10) and it didn't work.
How do you fix it so that the criteria of the SUMIF function involves the value in a specific cell? I'd like to set it this way because I have to apply the SUMIF function to the entire column. Ideally, the formulae in the cells of column D will be something similar to
=SUMIF(A1:A10,"<=C1",B1:B10)
=SUMIF(A1:A10,"<=C2",B1:B10)
etc.
Try this:
=SUMIF($A$1:$A$10,">="&C1,$B$1:$B$10)
Put it in D1 and fill down.