Excel #SPILL! error when there is nothing else in the spill range - excel-formula

In cell A1 i have the following:
=TOCOL(E1:G6,3)
In Cell B1 i have the following
=UNIQUE(VSTACK(E1:E6,F1:F6,G1:G6))
In cells E1 to G6 I have this formula
=LET(RandNum,RANDBETWEEN(1,100),IF(RandNum>90,NA(),RandNum))
There is nothing else on this worksheet.
I press F9 to recalculate and every now and again (with no apparent pattern) Cells A1 and B1 show #SPILL! errors.
Is there a valid reason for these #SPILL! errors or is this a bug in excel?
It appears to be as a result of the varying result range rather than anything being present in the spill range. If you copy and paste the range as values and re-calculate then A1 and B1 calculate just fine. It appears to be some sort of issue with the varying result range and the way spill formulas are calculated behind the scenes. It can sometimes take a while for this error to come up. It may come up more frequently if I change >90 to >50 so the variation in the size of the spill range is greater.

According to this support article...
https://support.microsoft.com/en-us/office/how-to-correct-a-spill-error-ffe0f555-b479-4a17-a6e2-ef9cc9ad4023
"Dynamic array resizes may trigger additional calculation passes to ensure the spreadsheet is fully calculated. If the size of the array continues to change during these additional passes and does not stabilize, Excel will resolve the dynamic array as #SPILL!."
https://support.microsoft.com/en-us/office/how-to-correct-a-spill-error-ffe0f555-b479-4a17-a6e2-ef9cc9ad4023
Thanks to Scott Craner for the useful comments. Hope this helps someone else.

Related

excel SUMIF not giving right answer

I have a table with data and I am trying to do the following on another sheet. I am trying to sum the price of items in a column if the date is a particular date. I filtered all the dates using UNIQUE on the second sheet and doing a SUMIF based on those values. The problem is, the results are all slightly less than the actual value obtained by manual summation/ highlighting the relevant cells and seeing the sum on the bottom. Why is this happening? The discrepancy cannot be attributed to any single cell it is supposed to sum.
btw anyone knows why the similar questions box seems to be bugging out? The original text stays in place as I scroll, like some kind of ghost effect.
edit: here is a picture of the problem
Here is what I think is the explanation.
From the documentation: The sum_range argument does not have to be the same size and shape as the range argument. The actual cells that are added are determined by using the upper leftmost cell in the sum_range argument as the beginning cell, and then including cells that correspond in size and shape to the range argument
Your formula: =SUMIF(F2:F31,"="&H2,G:G)
thus evaluates to =SUMIF(F2:F31,"="&H2,G1:G30)
Because of the offset in the ranges, the last instance of range = H2 gets dropped. And 34.86-33.67 = 1.19 which is the last cell that should be added.
In other words, g1 is evaluated against f2, and g13 is evaluated against f14. Since f14 does not contain 3/2/2020, the 1.19 does not get added by SUMIF
Sometimes this is useful. But here, as you note, it has an unwanted result.
It works in your first case because both range and sum_range start in the same row.
All you need to do to get it working in your second case is to ensure both ranges start at the same row.
eg: =SUMIF(F2:F31,"="&H2,G2) would work

Absolute Cell References Breaking

I have 3000 formulas that all have absolute cell references. I set them as the spreadsheets are accessed by about 50 people, and many people delete excess rows or insert rows even though we've instructed not to. I had thought that absolute cell references wouldn't break if a cell or a row was deleted, however it's still happening. They turn into #REF! and throw off all formulas further down in the chain.
I've manually fixed the absolute references a few times; however this takes a large amount of time that I won't have given a few weeks.
The formula is as follows, repeating in cells F1 through F3000:
=IF(AND($a$1>0,ISBLANK($d$1)),$a$1,"n/a")
They are then crosschecked for any that aren't n/a by a formula, as follows:
=IF(MIN(F1:F300)=0,"100%",MIN(F1:F3000))
The hope is that the formula that crosschecks for the lowest non-zero result, and will then spit out a date. Either changing the formulas with the absolute references so they won't result in #REF!, or changing the formula that cross references them so it ignores #REF! would work. Any and all help is greatly appreciated!
You can always ignore errors by wrapping the formula in an IFError function.
=Iferror(IF(MIN(F1:F300)=0,"100%",MIN(F1:F3000)),"")
I'm not quite clear why you use absolute references, if the formula is applied to cells F1 to F3000. It appears that the formula refers to cells in the current row. In this case, relative references would be a lot better, because they will survive the deletion of rows.
So, change =IF(AND($a$1>0,ISBLANK($d$1)),$a$1,"n/a") to =IF(AND(A1>0,ISBLANK(d1)),a1,"n/a")

Conditional pasting of values, making use of neighbouring cells

I have a large data set with quite a bunch of missing data and I'm having some problems to paste values to specified cells. The core of the problem is well illustrated below:
Simplified illustration of problem can be found here:
What I have tried is to make use of the IF statement to its neighbouring cell. But the condition should be set to a range of values not just one cel.
What I would like to find out: Is how to achieve this type of conditional pasting in an efficient way for a large dataset without doing it all by hand?
This can be done, using a combination of VLOOKUP() and IFNA():
=IFNA(VLOOKUP(E3;$A$3:$B$7;2;FALSE);"")
VLOOKUP(): look for cell E3 in the fix range $A$3:$B$7
From that range take the second column.
In case the value E3 is not found, an error is shown #N/A
IFNA(): in case of the error value, replace it by an empty string.
Don't forget to drag this formula from F3 to F10.

Return Match Values and also count this value for how many repeated in a range of cell in Excel

I am straggling with some formula that I have a spreadsheet that contains two range of cells. What I want to do is,
I would like to create a search Box that will search a value from Range A and if found return range B value and also will count of range B value is repeated.
Below image is for what I mean
I used INDEX, MATCH and also IF Functions :( but not really get what I wanted.
I am poor in formula, so it would be great if someone can figure out what kind of functions I should use for this.
For information, it can be achieved through formula as below.
E3 houses the value being searched for e.g. "A"
In cell F3 insert following array formula which needs to be committed by hitting CTRL+SHIFT+ENTER simultaneously.
=IFERROR(INDEX($B$1:$B$1000,SMALL(IF(IFERROR(MATCH($E$3&$B$1:$B$1000,$A$1:$A$1000&$B$1:$B$1000,0),0)=ROW($B$1:$B$1000),ROW($B$1:$B$1000)),ROWS($A$1:A1))),"")
Copy down as much as you need.
You need to adjust 1000 to suit your data. It should match last row.
In cell G3 you can use following formula.
=IF(F3="","",COUNTIFS(A:A,$E$3,B:B,F3))
Copy down as much as you need.

How to simplify 64 levels of nesting formula in Excel?

I encountered "64 levels of nesting" issue while working on my formula. Is there any way to simplify this formula? This formula worked fine up from 10 to 500 (G:G) but once over 510 something, it encountered "64 levels of nesting" issue. I found some solutions that involved lookup and match-index, but I can't see where/how to implement it here.
Formula is in cell B3:
=IF(B2<=$G$2,B2+($E$2*B2),IF(AND(B2>$G$2,B2<=$G$3),B2+($E$3*B2),IF(AND(B2>$G$3,B2<=$G$4),B2+($E$4*B2),IF(AND(B2>$G$4,B2<=$G$5),B2+($E$5*B2),IF(AND(B2>$G$5,B2<=$G$6),B2+($E$6*B2),IF(AND(B2>$G$6,B2<=$G$7),B2+($E$7*B2),IF(AND(B2>$G$7,B2<=$G$8),B2+($E$8*B2),IF(AND(B2>$G$8,B2<=$G$9),B2+($E$9*B2),IF(AND(B2>$G$9,B2<=$G$10),B2+($E$10*B2),IF(AND(B2>$G$10,B2<=$G$11),B2+($E$11*B2),IF(AND(B2>$G$11,B2<=$G$12),B2+($E$12*B2),IF(AND(B2>$G$12,B2<=$G$13),B2+($E$13*B2),IF(AND(B2>$G$13,B2<=$G$14),B2+($E$14*B2),IF(AND(B2>$G$14,B2<=$G$15),B2+($E$15*B2),IF(AND(B2>$G$15,B2<=$G$16),B2+($E$16*B2),IF(AND(B2>$G$16,B2<=$G$17),B2+($E$17*B2),IF(AND(B2>$G$17,B2<=$G$18),B2+($E$18*B2),IF(AND(B2>$G$18,B2<=$G$19),B2+($E$19*B2),IF(AND(B2>$G$19,B2<=$G$20),B2+($E$20*B2),IF(AND(B2>$G$20,B2<=$G$21),B2+($E$21*B2),IF(AND(B2>$G$21,B2<=$G$22),B2+($E$22*B2),IF(AND(B2>$G$22,B2<=$G$23),B2+($E$23*B2),IF(AND(B2>$G$23,B2<=$G$24),B2+($E$24*B2),IF(AND(B2>$G$24,B2<=$G$25),B2+($E$25*B2),IF(AND(B2>$G$25,B2<=$G$26),B2+($E$26*B2))))))))))))))))))))))))))
Cells $A2:$A26 & cells $E2:$E26 are variable. Cells $D2:$D26 are just my indicator. Others are constant value.
Cells $B2:$B26 will calculate the formula $A2+$A2* percentage. The percentage is based on the value which is in cells $E2:$E26. The value is then determine by the value in cells $A2:$A26.
Formula in cells $B2:$B26 are as previous formula dragged down.
Example:
If the cost is 50. The value of percentage will be taken from cell $E$7. In this case is 10 thus returning the value in $B$6 to $A6+$A6*10=55
Please refer to ss 2.
excel screenshot 2
If you reach the nesting limit that nearly always means there's an easier way....
You should be able to do this much more simply with a lookup type formula, e.g.
=B2+B2*IF(B2<G$2,E$2,INDEX(E$3:E$26,MATCH(TRUE,INDEX(B2>G$2:G$25,0),0))
This finds the first value in column G which is > B2 and then gets the required value from the next row in column E
The only thing this formula doesn't do is impose an upper limit on B2 (yours is the G26 value 250). If that's an issue you can just add an extra IF to cater for that
You might want to rework your tables but an INDEX/MATCH with a relative lookup on ascending data will return the correct percentage.
=b2*index(e2:e26, match(b2, g2:g26, 1))
Not 100% sure I understand your formula/intent. I think I got it...if not please clarify.
add another column that does the math in column H. enter this formula and drag down.
=($B$2+(E2*$B$2))
in cell B3 enter this formula
=VLOOKUP(ROUNDUP(B2,-1),G:H,2,FALSE)

Resources