SOLVED

IF Function Help

%3CLINGO-SUB%20id%3D%22lingo-sub-3341356%22%20slang%3D%22en-US%22%3EIF%20Function%20Help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3341356%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20use%20the%20IF%20function%20but%20the%20output%20says%20%22%23SPILL%22.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMay%20you%20help%20me%20let%20me%20know%20where%20I%20went%20wrong%20with%20the%20IF%20Function%20equation%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKindly%20see%20attached%20for%20%22Raw%20Data%22%20and%20%22Summary%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EAmy%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3341356%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3341482%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20Function%20Help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3341482%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1260738%22%20target%3D%22_blank%22%3E%40AmyYang%3C%2FA%3E%26nbsp%3BWhen%20you%20take%20your%20formula%20outside%20the%20table%2C%20you'll%20note%20that%20it%20creates%20a%20dynamic%20array.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Riny_van_Eekelen_1-1652079752500.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F370109i3F2896468EAA2DE2%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Riny_van_Eekelen_1-1652079752500.png%22%20alt%3D%22Riny_van_Eekelen_1-1652079752500.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20you%20can't%20use%20that%20inside%20a%20structured%20table.%20You%20could%20wrap%20the%20formula%20in%20SUM%20to%20return%20a%20single%20value.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Riny_van_Eekelen_0-1652079967438.png%22%20style%3D%22width%3A%20501px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F370110iC5B2D9012D39E5CB%2Fimage-dimensions%2F501x189%3Fv%3Dv2%22%20width%3D%22501%22%20height%3D%22189%22%20role%3D%22button%22%20title%3D%22Riny_van_Eekelen_0-1652079967438.png%22%20alt%3D%22Riny_van_Eekelen_0-1652079967438.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EAlternatively%20use%20SUMIFS%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DSUMIFS(Table1%5BASR%20(W)%0A(Incidence%20per%20100%20000%20Population)%5D%2CTable1%5BIndication%5D%2C%5B%40Indication%5D%2CTable1%5BPopulation%5D%2C%5B%40Country%5D)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3342081%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20Function%20Help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3342081%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1260738%22%20target%3D%22_blank%22%3E%40AmyYang%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B%20has%20pointed%20out%2C%20each%20row%20of%20your%20summary%20table%20examines%20every%20row%20of%20your%20raw%20date.%26nbsp%3B%20In%20the%20event%20of%20more%20than%20one%20match%2C%20what%20would%20you%20wish%20to%20have%20returned%3A%20the%20first%2C%20the%20last%2C%20the%20sum%2C%20the%20max%3F%26nbsp%3B%20If%20you%20can%20be%20absolutely%20sure%20there%20is%20only%20one%20match%2C%20pretty%20much%20any%20one%20of%20these%20would%20do.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20simplest%20answer%20is%20then%20to%20wrap%20your%20existing%20formula%20in%20SUM%2C%20or%20you%20could%20use%20an%20XLOOKUP%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20XLOOKUP(1%2C%0A%20%20%20%20(Table1%5BIndication%5D%3D%5B%40Indication%5D)%20*%20(Table1%5BPopulation%5D%3D%5B%40Country%5D)%2C%0A%20%20%20%20%20Table1%5BASR%20(W)%5D)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3348693%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20Function%20Help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3348693%22%20slang%3D%22en-US%22%3EDear%20Riny%2C%3CBR%20%2F%3E%3CBR%20%2F%3EUnderstood%2C%20thanks%20so%20much%20for%20your%20explanation!%3CBR%20%2F%3E%3CBR%20%2F%3ERegards%2C%3CBR%20%2F%3EAmy%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3348696%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20Function%20Help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3348696%22%20slang%3D%22en-US%22%3EDear%20Peter%2C%3CBR%20%2F%3E%3CBR%20%2F%3ENoted%2C%20thank%20you%20for%20your%20detailed%20explanation%2C%20that's%20helpful.%3CBR%20%2F%3EThank%20you%20for%20sharing%20the%20formula%20with%20SUM%20versus%20XLOOKUP%20for%20comparison.%3CBR%20%2F%3E%3CBR%20%2F%3ERegards%2C%3CBR%20%2F%3EAmy%3C%2FLINGO-BODY%3E
Contributor

Hi, 

 

I am trying to use the IF function but the output says "#SPILL". 

 

May you help me let me know where I went wrong with the IF Function equation? 

 

Kindly see attached for "Raw Data" and "Summary".

 

Thanks,

Amy 

4 Replies
best response confirmed by AmyYang (Contributor)
Solution

@AmyYang When you take your formula outside the table, you'll note that it creates a dynamic array.

Riny_van_Eekelen_1-1652079752500.png

 

And you can't use that inside a structured table. You could wrap the formula in SUM to return a single value.

Riny_van_Eekelen_0-1652079967438.png

Alternatively use SUMIFS

=SUMIFS(Table1[ASR (W)
(Incidence per 100 000 Population)],Table1[Indication],[@Indication],Table1[Population],[@Country])

 

 

@AmyYang 

As @Riny_van_Eekelen  has pointed out, each row of your summary table examines every row of your raw date.  In the event of more than one match, what would you wish to have returned: the first, the last, the sum, the max?  If you can be absolutely sure there is only one match, pretty much any one of these would do.

 

The simplest answer is then to wrap your existing formula in SUM, or you could use an XLOOKUP

= XLOOKUP(1,
    (Table1[Indication]=[@Indication]) * (Table1[Population]=[@Country]),
     Table1[ASR (W)])

 

Dear Riny,

Understood, thanks so much for your explanation!

Regards,
Amy
Dear Peter,

Noted, thank you for your detailed explanation, that's helpful.
Thank you for sharing the formula with SUM versus XLOOKUP for comparison.

Regards,
Amy