Excel error - formula contains SUMIFS, and OR and Some Dates - excel

I'm trying to get the formula below to work but I'm getting a #Spill! error
Adding Feb-20 works fine but adding the Mar-20 appears to break something.
=SUMIFS(Calcs!CZ:CZ,Calcs!$AL:$AL,{"Feb-20","Mar-20"},Calcs!$AJ:$AJ,"<>"&"")

I think that due to the later additions into excel, the modern interpretation of array criteria is that for each of your criteria, it produces an array of answers, so you are getting #Spill! because excel is trying to make your single celled sumifs formula spill into two cells, each using a single criteria of your array criteria:
one cell having this formula in:
=SUMIFS(Calcs!CZ:CZ,Calcs!$AL:$AL,"Feb-20",Calcs!$AJ:$AJ,"<>"&"")
and the other cell having this formula in:
=SUMIFS(Calcs!CZ:CZ,Calcs!$AL:$AL,"Mar-20",Calcs!$AJ:$AJ,"<>"&"")
The spill error is likely because the cell adjacent to the cell you are performing this sumifs formula in has something in it.
documentation on this here:
https://www.excelcampus.com/functions/dynamic-array-formulas-spill-ranges/
My suggestion therefore is to simply wrap your current formula with a final sum, like this:
=SUM(SUMIFS(Calcs!CZ:CZ,Calcs!$AL:$AL,{"Feb-20","Mar-20"},Calcs!$AJ:$AJ,"<>"&""))

Related

Using COUNTIFS in Excel, check cells (containing formulas) that are empty

Good day.
In it's basic form, I need to count how many cells are empty.
Using the following below, I can count how many cells are empty.
=COUNTIF(Sheet1!C:C,"<>")
However, if the cells in column C contain formulas, it won't work.
After some googling, I found out that using SUMPRODUCT will get what I need
=SUMPRODUCT(--(LEN(Sheet1!C:C)>0))
Now, here's my problem.
I need to use that as a criteria inside a COUNTIFS function, but I don't know how to do that because it's referencing some ranges.
So just to make it simple, using COUNTIF or COUNTIFS function specifically, how can I pass a criteria that checks if cell (with formula) is empty.
This formula returns 0 but most likely I'm just not passing it properly as a criteria.
=COUNTIF(Sheet1!C:C,SUMPRODUCT(--(LEN(Sheet1!C:C)>0)))
Happy for other ways to count cells (with formulas) which are empty, but I need to use it as a criteria for a COUNTIF/COUNTIFS function.
Thank you very much.
If I understand what you're looking for, you were pretty close already.
Following the formula's you already found you can use them like:
=COUNTIF(Sheet1!C:C,"<>")-SUMPRODUCT(--(LEN(Sheet1!C:C)>0))
It will result in the count of cells that have a value/formula minus the count of cells that show a value (blank formula result is excluded).
The result is the count of cells that contain a formula with blank result.

COUNTIFS function not working with single cell range

I'm having an issue with COUNTIFS function in excel, i have a very large formula that I was getting an error on, but I have slowly taken the formula apart to a smaller subset and identified the issue I'm having. Excel won't use COUNTIFS correctly when the criteria range is one cell. Here's the formula I'm using:
=COUNTIFS(A7:A7,1,Sheet1!F:F,$A$9,Sheet2!S:S,$B$8)
Whenever I take the first criteria out "A7:A7,1" my formula returns a value, without it I receive #VALUE! error. Can you not use one cell as the criteria for CountIFS? I've also tried replacing "A7:A7" with just "A7" or "$A$7". The first criteria is the most important, because i'm going to be using a listbox for that cell that will change the values in my range for interactive graphs..
The ranges in the countifs need to be the same size.
Wrap the COUNTIFS() in a IF:
=IF(A7=1,COUNTIFS(Sheet1!F:F,$A$9,Sheet2!S:S,$B$8),0)

Excel: Sumproduct not working when blanks in data set

I am trying to get a sumproduct function to average a column based on criteria in prior adjacent columns.
The column i am trying to average is calculated from a formula that has an IFERROR to return a blank if there is an error.
=IFERROR(A5*B3,"")
some of the cells in that column containt the blank generated by the if error statement, my sumproduct is giving a #value error when it tries to average the range with the blank. I want it treated as nothing not as 0
Is there anyway around this or should I try to recreate my sumproduct using some sort of averageifs function?
This is the sumproduct in question:
=SUMPRODUCT((Data!$KM$7:$OV$7=C$7)*(Data!$KM$9:$OV$118>=$B10)*(Data!$KM$9:$OV$118<=$A10)*(Data!$BLW$9:$BLW$118))/SUMPRODUCT((Data!$KM$7:$OV$7=C$7)*(Data!$KM$9:$OV$118>=$B10)*(Data!$KM$9:$OV$118<=$A10))
Try this array formula instead:
=AVERAGE(IF((Data!$KM$7:$OV$7=C$7)*(Data!$KM$9:$OV$118>=$B10)*(Data!$KM$9:$OV$118<=$A10)*(Data!$BLW$9:$BLW$118<>""),Data!$BLW$9:$BLW$118))
Being an array it needs to be confirmed with Ctrl-Shift-Enter when leaving edit mode. If done properly excel will put {} around the formula.
The reason SUMPRODUCT will not work is it tries to multiply a string, albeit an empty string but a string none the less, with numbers, which will throw an error.
The array formula ignores all the empty string cells and skips them.
The formula =IFERROR(A5*B3,"") puts a "" in the cell. This is not a value, so formulas using this cell won't work. You need to turn it to a numeric value even though it is blank
Use =value(IFERROR(A5*B3,""))
=SUMPRODUCT(P10,M10,L14,L13). This could be easy. We have to write what we want to do rather it is sum, product, division or subtract

Median Calculation in Excel with Conditions

I am having trouble getting the following Excel formula to work. I think I am having an issue with my parenthesis. I am trying to take the median based off of 3 conditions. The last condition is a date range.
=MEDIAN(IF($G$3:$G$458=$K$3,IF($A$3:$A$458=M$3,IF(AND($E$3:$E$458>DATEVALUE("1/1/2014"),$E$3:$E$458<DATEVALUE("12/31/2014")),$H$3:$H$458))))
Your formula is correct you just need to hit CTRL+SHIFT+ENTER to make it an array formula.
Whenever you apply a formula (E3:E458=$E$458) to a range within one cell you need to make the calculation an array formula.

Formula returns #VALUE! when entered as array

I've put together an Excel spreadsheet to keep track of employees' time off using an array formula. The formula works for date ranges that are entered as "mm/dd - mm/dd", but I'd like it to also support single dates "mm/dd". However, I get a #VALUE! error when one of the cells in the range is of this format, even though the formula supports both formats when not entered as an array formula.
Example:
With the value "11/28" in cell B2, and a table of holidays in B31:B37, the following formula accurately calculates the number of work days as 1.
=SUM(IF(ISBLANK(B2),0,(IF(ISERR(FIND("-",B2)),NETWORKDAYS(B2,B2,$B$31:$B$37),NETWORKDAYS(LEFT(B2,5),MID(B2,FIND("- ",B2)+2,5),$B$31:$B$37)))))
If the value of B2 is "11/28 - 12/03", the formula returns 4.
I want this formula to work over a range of of cells for each employee, so I expand the range from "B2" to "B2:B10", and enter as the following array formula:
=SUM(IF(ISBLANK(B2:B10),0,(IF(ISERR(FIND("-",B2:B10)),NETWORKDAYS(B2:B10,B2:B10,$B$31:$B$37),NETWORKDAYS(LEFT(B2:B10,5),MID(B2:B10,FIND("- ",B2:B10)+2,5),$B$31:$B$37)))))
This formula works fine when every cell in the range is blank or has a date range of "mm/dd - mm/dd". However, if one of the cells has a single date "mm/dd", it throws a #VALUE! error.
What am I missing?
If there is no "-" in a given string then the FIND function will return a #VALUE! error for that string.
In general, there are two ways to resolve such issues. One is to include an error trap; the other, slightly longer though perhaps nevertheless preferable (IFERROR clauses are generally best avoided if possible), is to make suitable amendments to the strings being passed to MID and FIND such that this combination of functions does not error, whilst also ensuring that correct results are returned.
One such solution (still array-entered) is:
=SUM(IF(B2:B10<>"",NETWORKDAYS(LEFT(B2:B10,5),MID(B2:B10&"- "&B2:B10,FIND("- ",B2:B10&"- ")+2,5),$B$31:$B$37)))
Regards

Resources