SOLVED

SPILL ERROR with SUMProduct and lookup from other sheet

%3CLINGO-SUB%20id%3D%22lingo-sub-2265955%22%20slang%3D%22en-US%22%3ESPILL%20ERROR%20with%20SUMProduct%20and%20lookup%20from%20other%20sheet%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2265955%22%20slang%3D%22en-US%22%3E%3CUL%3E%3CLI%3E%3CSTRONG%3EDevice%20and%20OS%20platform%3C%2FSTRONG%3E%2C%20Laptop%2FWindows%2010%26nbsp%3B%3C%2FLI%3E%3CLI%3E%3CSTRONG%3EExcel%20product%20name%20and%20version%20number%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3BOffice%20365%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSTRONG%3EExcel%20file%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSTRONG%3EAttached%20-%20specifically%20looking%20at%20cells%20T5%20and%20T12%3C%2FLI%3E%3CLI%3EI'm%20attempting%20to%20use%20the%20same%20formula%20that%20appears%20in%20cells%20P2%3AP7%20-%20P9%3AP14%20%26amp%3B%20T2%3AT4%20-%20T6%3AT7%20-%20T9%3AT11%20-%20T13%3AT14.%20However%2C%20when%20having%20the%20formula%20the%20same%20it%20would%20return%20a%20value%20not%20based%20on%20the%20date%20being%20in%20January%20in%20cells%20C16%3AC4000.%20I%20attempted%20to%20add%20the%20additional%20section%20of%20the%20formula%20--(ISNUMBER(C16%3AC4000))%20that%20was%20in%20there%20prior%20to%20adding%20the%20lookup%20of%20sheet1%2C%20but%20when%20I%20did%20it%20returned%20the%20SPILL%20Error.%20If%20I%20leave%20the%20formula%20without%20the%20ISNUMBER%20part%20the%20result%20will%20total%20the%20items%20in%20the%20H16%3AH4000%20regardless%20of%20the%20date%20in%20C16%3AC4000.%26nbsp%3B%3C%2FLI%3E%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2265955%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2266870%22%20slang%3D%22en-US%22%3ERe%3A%20SPILL%20ERROR%20with%20SUMProduct%20and%20lookup%20from%20other%20sheet%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2266870%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1022655%22%20target%3D%22_blank%22%3E%40cparb%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThese%20are%20different%20formulas%2C%20For%20example%2C%20in%20P7%20is%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DSUMPRODUCT(--(MONTH(C16%3AC4000)%3D7)%2C%0A((%24H%2416%3A%24H%244000%3DSheet1!%24A%241)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%242)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%243)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%244)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%245)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%246)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%247)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%248)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%249)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%2410)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%2411)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%2412)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%2413)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%2414)%2B%0A(%24H%2416%3A%24H%244000%3DSheet1!%24A%2415))%0A)%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Ewhich%20returns%20number%20of%20records%20with%20July%20date%20and%20any%20of%20titles%20from%20Sheet1%20in%20column%20H.%3C%2FP%3E%0A%3CP%3EIn%20T5%20is%20different%20formula%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DSUMPRODUCT(%20--ISNUMBER(C16%3AC4000)%2C--MONTH(C16%3AC4000)%3D1)*%0A((%24H%2416%3A%24H%244000%3DSheet1!%24A%241)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%242)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%243)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%244)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%245)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%246)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%247)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%248)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%249)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%2410)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%2411)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%2412)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%2413)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%2414)%2B%0A%20(%24H%2416%3A%24H%244000%3DSheet1!%24A%2415)%0A)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EYou%20sum%20all%20records%20with%20July%20date%20and%20multiple%20this%20numbers%20on%20array%20of%20values%20which%20indicates%20if%20any%20from%20Sheet1%20is%20in%20column%20H.%20Result%20is%20array%20which%20formulas%20try%20to%20return.%20But%20that's%20not%20enough%20space%20for%20this%20array%20in%20the%20sheet%2C%20thus%20%23SPILL%20error.%3C%2FP%3E%0A%3CP%3EI'm%20not%20sure%20what%20exactly%20you'd%20like%20to%20calculate%2C%20as%20varioant%20formula%20could%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DSUM(%20(MONTH(%24C%2416%3A%24C%244000)%3DMONTH(1%26amp%3BO5))*%0A%20%20%20%20%20%20%20COUNTIF(Sheet1!%24A%241%3A%24A%2415%2C%24H%2416%3A%24H%244000)%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
New Contributor
  • Device and OS platform, Laptop/Windows 10 
  • Excel product name and version number Office 365
  • Excel file Attached - specifically looking at cells T5 and T12
  • I'm attempting to use the same formula that appears in cells P2:P7 - P9:P14 & T2:T4 - T6:T7 - T9:T11 - T13:T14. However, when having the formula the same it would return a value not based on the date being in January in cells C16:C4000. I attempted to add the additional section of the formula --(ISNUMBER(C16:C4000)) that was in there prior to adding the lookup of sheet1, but when I did it returned the SPILL Error. If I leave the formula without the ISNUMBER part the result will total the items in the H16:H4000 regardless of the date in C16:C4000. 
3 Replies
best response confirmed by cparb (New Contributor)
Solution

@cparb 

These are different formulas, For example, in P7 is

=SUMPRODUCT(--(MONTH(C16:C4000)=7),
(($H$16:$H$4000=Sheet1!$A$1)+
($H$16:$H$4000=Sheet1!$A$2)+
($H$16:$H$4000=Sheet1!$A$3)+
($H$16:$H$4000=Sheet1!$A$4)+
($H$16:$H$4000=Sheet1!$A$5)+
($H$16:$H$4000=Sheet1!$A$6)+
($H$16:$H$4000=Sheet1!$A$7)+
($H$16:$H$4000=Sheet1!$A$8)+
($H$16:$H$4000=Sheet1!$A$9)+
($H$16:$H$4000=Sheet1!$A$10)+
($H$16:$H$4000=Sheet1!$A$11)+
($H$16:$H$4000=Sheet1!$A$12)+
($H$16:$H$4000=Sheet1!$A$13)+
($H$16:$H$4000=Sheet1!$A$14)+
($H$16:$H$4000=Sheet1!$A$15))
)

which returns number of records with July date and any of titles from Sheet1 in column H.

In T5 is different formula

=SUMPRODUCT( --ISNUMBER(C16:C4000),--MONTH(C16:C4000)=1)*
(($H$16:$H$4000=Sheet1!$A$1)+
 ($H$16:$H$4000=Sheet1!$A$2)+
 ($H$16:$H$4000=Sheet1!$A$3)+
 ($H$16:$H$4000=Sheet1!$A$4)+
 ($H$16:$H$4000=Sheet1!$A$5)+
 ($H$16:$H$4000=Sheet1!$A$6)+
 ($H$16:$H$4000=Sheet1!$A$7)+
 ($H$16:$H$4000=Sheet1!$A$8)+
 ($H$16:$H$4000=Sheet1!$A$9)+
 ($H$16:$H$4000=Sheet1!$A$10)+
 ($H$16:$H$4000=Sheet1!$A$11)+
 ($H$16:$H$4000=Sheet1!$A$12)+
 ($H$16:$H$4000=Sheet1!$A$13)+
 ($H$16:$H$4000=Sheet1!$A$14)+
 ($H$16:$H$4000=Sheet1!$A$15)
)

You sum all records with July date and multiple this numbers on array of values which indicates if any from Sheet1 is in column H. Result is array which formulas try to return. But that's not enough space for this array in the sheet, thus #SPILL error.

I'm not sure what exactly you'd like to calculate, as varioant formula could be

=SUM( (MONTH($C$16:$C$4000)=MONTH(1&O5))*
       COUNTIF(Sheet1!$A$1:$A$15,$H$16:$H$4000)
)

@Sergei Baklan 

 

The formulas in the other cells listed are accurate as they are only pulling the total from cells H16:H4000 based on the dates listed in cells C16:C4000. The only issue I'm having is the same formula is not working for January. What January is doing is that it is pulling the if the criteria is met in cells H16:H4000 regardless of the dates listed in cells C16:C4000. I attempted to make your correction provided however it is still pulling the data regardless of the dates. 

 

The end result for cells T5 and T12 need to be same as the other cells except it should only pull if the date in C16:C4000 is in January. This is where I'm hitting a wall with the formula  

What I did just test is that if there is another date in C16:C4000 it won't pick up though so I think that it does meet my needs as there wouldn't be criteria in H16:H4000 without a date in C16:C4000 so the result won't have data that it shouldn't. Thank you!