Discussion Re: SPILL Error on IF function in Excel
https://techcommunity.microsoft.com/t5/excel/spill-error-on-if-function/m-p/3273147#M140649
<P><LI-USER uid="1341490"></LI-USER> </P>
<P>Latest formula also returns 1 million values array in each element of it we have text if condition is met for related row in columns E and F, otherwise FALSE.</P>
<P>=IF( column, something) returns as many elements as you have them in entire column.</P>Thu, 31 Mar 2022 21:09:37 GMTSergei Baklan2022-03-31T21:09:37ZSPILL Error on IF function
https://techcommunity.microsoft.com/t5/excel/spill-error-on-if-function/m-p/3273117#M140636
<P>Hi All, <BR /><BR />I'm having trouble locating the error in my formula. I have a data sheet '012021' where column E is a list of locations (some duplicated) and f-g a various number values. The duplicate cities have erroneous data attached, so I only need the rows that have the largest value in column f. <BR /><BR />Cleaning up the data and removing duplicates isn't an option as the file is just too large.<BR /><BR />Finding the value of the matching city in column f is easy D3 is Philadelphia, PA for this example: <BR />=MAX(IF('012021'!E:E=D3,'012021'!F:F) <BR /><BR />Yet when I try to find G, I get a spill error: <BR />=IF('012021'!E:E=C6,IF('012021'!F:F=D6),'012021'G:G))<BR /><BR />I even tried changing the return value to a single string and I'm still getting a SPILL error. <BR />=IF('012021'!E:E=C6,IF('012021'!F:F=D6),"hey it finally worked"))<BR /><BR /><BR />What am I missing?</P>Thu, 31 Mar 2022 20:24:02 GMThttps://techcommunity.microsoft.com/t5/excel/spill-error-on-if-function/m-p/3273117#M140636dasoidas2022-03-31T20:24:02ZRe: SPILL Error on IF function
https://techcommunity.microsoft.com/t5/excel/spill-error-on-if-function/m-p/3273121#M140638
<P><LI-USER uid="1341490"></LI-USER> </P>
<P>If you enter that formula in any cell in first row, it returns an array of 1048576 rows with result.</P>
<P>If in any other row it returns #SPILL! error since there is not enough space to place more than one million of values.</P>
<P>Not sure what you try to return exactly, in any case use ranges, tables or dynamic ranges, not entire column in calculations.</P>
<P>By the way, more correct syntax</P>
<LI-CODE lang="excel-formula">=IF('012021'!E:E=C6,IF('012021'!F:F=D6,'012021'!G:G,))</LI-CODE>Thu, 31 Mar 2022 20:33:09 GMThttps://techcommunity.microsoft.com/t5/excel/spill-error-on-if-function/m-p/3273121#M140638Sergei Baklan2022-03-31T20:33:09ZRe: SPILL Error on IF function
https://techcommunity.microsoft.com/t5/excel/spill-error-on-if-function/m-p/3273143#M140647
yup syntax was a typo, the sheet names are actually an indirect function to use a cell value to direct to the correct sheet, and when editing it to post here I missed removing a parentheses.<BR /><BR />So I can't do ranges dynamic or otherwise due to the multiple sheets with varying sizes. (and a number of other reasons). I could make a macro that edits the formulas each time we refer to a different sheet, but thats extra work to create a workaround, rather than resolving the formula error.<BR /><BR /><BR />I understand it's returning too many results, the question is why. There is only 1 row where D6 and C6 match. In fact there's only 1 row where d6 matches.<BR /><BR />Also in the last formula I provided, I"m returning a singular string and not any array, yet there's still a SPILL error. If the first if is true, it returns the second if, which, if true returns ""hey it finally worked". The if's should either be true or false, and return the true value. But even when the true value is a string, its returning an array.Thu, 31 Mar 2022 20:58:58 GMThttps://techcommunity.microsoft.com/t5/excel/spill-error-on-if-function/m-p/3273143#M140647dasoidas2022-03-31T20:58:58ZRe: SPILL Error on IF function
https://techcommunity.microsoft.com/t5/excel/spill-error-on-if-function/m-p/3273147#M140649
<P><LI-USER uid="1341490"></LI-USER> </P>
<P>Latest formula also returns 1 million values array in each element of it we have text if condition is met for related row in columns E and F, otherwise FALSE.</P>
<P>=IF( column, something) returns as many elements as you have them in entire column.</P>Thu, 31 Mar 2022 21:09:37 GMThttps://techcommunity.microsoft.com/t5/excel/spill-error-on-if-function/m-p/3273147#M140649Sergei Baklan2022-03-31T21:09:37ZRe: SPILL Error on IF function
https://techcommunity.microsoft.com/t5/excel/spill-error-on-if-function/m-p/3273763#M140769
=IF( column, something) returns as many elements as you have them in entire column.<BR />Ah ok that's the part I was missing. I didn't realize IF functions iterate and return through each instance.<BR /><BR />Thank you Sergei!<BR /><BR />For anyone that runs into this I resolved using XLOOKUP (which I had originally tried but other data issues made that not an option. Luckily those data issues aren't any issue anymore.Fri, 01 Apr 2022 14:55:14 GMThttps://techcommunity.microsoft.com/t5/excel/spill-error-on-if-function/m-p/3273763#M140769dasoidas2022-04-01T14:55:14Z