Home

IF FUNCTION HELP

%3CLINGO-SUB%20id%3D%22lingo-sub-1128309%22%20slang%3D%22en-US%22%3EIF%20FUNCTION%20HELP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1128309%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20and%20Help%20please!%3C%2FP%3E%3CP%3EHere's%20what%20I'm%20trying%20to%20accomplish%20but%20either%20get%20a%20spill%20error%20or%20just%20a%20general%20problem%20with%20the%20formula%20error.%20I'm%20basically%20asking%20that%20from%20the%20data%20in%20column%20A2%3AA1146%20if%20it%20equals%20a%20certain%20number%20to%20put%20a%20name%20in%20column%20B.%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(A2%3AA1146%3D(700047%3A700058%3A700059%3A700071%3A700086%3A700091)%2C%22%20Jackie%22%2C%20IF(A2%3AA1146%3D(700053%3A700057%3A700063%3A700076%3A700079)%2C%20%22Frezell%22%2C%20IF(A2%3AA1146%3D(700049%3A700051%3A700055%3A700062%3A700087%3A700090)%2C%20%22Erika%22%2C%20IF(A2%3AA1146%3D(700056%3A700068%3A700085%3A700094%3A700095%3A700096%3A700097%3A700098)%2C%20%22Arlesia%22%2C%20IF(A2%3AA1146%3D(700048%3A700050%3A700060%3A700061%3A700064%3A700070%3A700072%3A700077%3A700088%3A700089)%2C%20%22Scott%22%2C%20IF(A2%3AA1146%3D(700052%3A700054%3A700065%3A700066%3A700080)%2C%20%22Jody%22%2C%20IF(A2%3AA1146%3D(700103%3A700104%3A700106%3A700107%3A700108%3A700109%3A700110)%2C%20%22Anthony%22%2C%20IF(A2%3AA1146%3D(700093%3A700099%3A700100%3A700101%3A700102%3A700105%3A700111%3A700113)%2C%20%22Kandi%22%2C%20IF(A2%3AA1146%3D(700075%3A700078%3A700081%3A700084%3A700112%3A700114)%2C%20%22Latesha%22%2C%20IF(A2%3AA1146%3D(700067%3A700069%3A700073%3A700074%3A700082%3A700083%3A700092)%2C%20%22Jenn%22))))))))))%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1128309%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1128344%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20FUNCTION%20HELP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1128344%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F531949%22%20target%3D%22_blank%22%3E%40pbjrex%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWith%20all%20that%20logic%20you%20might%20be%20best%20off%20creating%20a%20lookup%20table%20then%20run%20a%20VLOOKUP%20off%20of%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1128348%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20FUNCTION%20HELP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1128348%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F428790%22%20target%3D%22_blank%22%3E%40Patrick2788%3C%2FA%3E%26nbsp%3Bsurprisingly%20I%20do%20more%20If%20functions%20than%20I%20have%20VLookup.%20How%20would%20I%20initiate%20that%3F%20And%20thank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1128743%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20FUNCTION%20HELP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1128743%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F531949%22%20target%3D%22_blank%22%3E%40pbjrex%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESample%20attached.%20Hope%20this%20helps.%20Enjoy%20your%20weekend!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1128830%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20FUNCTION%20HELP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1128830%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F520173%22%20target%3D%22_blank%22%3E%40shawb%3C%2FA%3E%26nbsp%3BThank%20you!%20I'll%20try%20this%20now!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1128605%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20FUNCTION%20HELP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1128605%22%20slang%3D%22en-US%22%3E%3CP%3EWhat%20you've%20written%20is%20a%20dynamic%20array%20formula--If%20excel%20is%20giving%20you%20a%20spill%20error%2C%20your%20formula%20wants%20to%20return%20a%20range%20and%20there%20are%20values%20in%20adjacent%20cells%20preventing%20it%20from%20doing%20so.%20Clear%20up%20some%20space%20around%20the%20cell%20your%20formula%20is%20in.%3CBR%20%2F%3E%3CBR%20%2F%3EDo%20you%20mean%20that%20Jackie%20can%20be%20associated%20with%20700047%20or%2070058%2C%20etc%3F%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20so%2C%20you%20want%20to%20pop%20those%20inside%20the%20OR%20function.%20Also%2C%20remove%20the%20range%20and%20just%20leave%20A2%20and%20drag%20the%20formula%20down%20column%20B.%3CBR%20%2F%3E%3CBR%20%2F%3EIF(OR(%24A2%3D70047%2C%20%24A2%3D70058)%2C%20%22Jackie%22%2CIF(OR(%24A2%3D70053%2C%24A2%3D70057)%2C%22Frezell%22%2CIF(...%20this%20will%20solve%20your%20issue%20of%20the%20array%20formula%20and%20prevent%20spill%20errors.%20When%20you%20drag%20the%20formula%20down%20column%20B%2C%20A2%20will%20change%20to%20A3%20in%20the%20next%20row.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1129470%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20FUNCTION%20HELP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1129470%22%20slang%3D%22en-US%22%3Eany%20advice%20it%20there%20are%20too%20many%20arguments%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1129471%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20FUNCTION%20HELP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1129471%22%20slang%3D%22en-US%22%3EThank%20you!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1129955%22%20slang%3D%22en-US%22%3ERe%3A%20IF%20FUNCTION%20HELP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1129955%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F531949%22%20target%3D%22_blank%22%3E%40pbjrex%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhat%20the%20formula%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DIF(%0A%20%20%20A2%3AA1146%3D(700047%3A700058%3A700059%3A700071%3A700086%3A700091)%2C%22%20Jackie%22%2C%0AIF(%0A%20%20%20A2%3AA1146%3D(700053%3A700057%3A700063%3A700076%3A700079)%2C%20%22Frezell%22%2C%0AIF(...%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Edoes%20it%20compares%20A2%3AA1146%20with%20combines%20ranges%20from%20row%20700047%20to%20row%20700058%20plus%26nbsp%3Bfrom%20row%20700059%20to%20row%20700071%2C%20etc.%20If%20such%20rows%20ranges%20in%20formula%20are%20paired%2C%20Excel%20with%20dynamic%20arrays%20returns%20huge%20resulting%20array%20(which%20has%20no%20sense%20in%20any%20case)%20for%20which%20is%20not%20enough%20space%20in%20the%20sheet%20to%20place.%20If%20not%20paired%20as%20for%20the%20second%20IF%20formula%20Excel%20simply%20says%20you%20try%20to%20use%20incorrect%20formula.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBit%20more%20practical%20will%20be%20the%20formula%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%7B700047%2C700058%2C700059%2C700071%2C700086%2C700091%7D%2C0))%2C%22Jackie%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%7B700053%2C700057%2C700063%2C700076%2C700079%7D%2C0))%2C%22Frezell%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%7B700049%2C700051%2C700055%2C700062%2C700087%2C700090%7D%2C0))%2C%22Erika%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%7B700056%2C700068%2C700085%2C700094%2C700095%2C700096%2C700097%2C700098%7D%2C0))%2C%22Arlesia%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%7B700048%2C700050%2C700060%2C700061%2C700064%2C700070%2C700072%2C700077%2C700088%2C700089%7D%2C0))%2C%22Scott%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%7B700052%2C700054%2C700065%2C700066%2C700080%7D%2C0))%2C%22Jody%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%7B700103%2C700104%2C700106%2C700107%2C700108%2C700109%2C700110%7D%2C0))%2C%22Anthony%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%7B700093%2C700099%2C700100%2C700101%2C700102%2C700105%2C700111%2C700113%7D%2C0))%2C%22Kandi%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%7B700075%2C700078%2C700081%2C700084%2C700112%2C700114%7D%2C0))%2C%22Latesha%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%7B700067%2C700069%2C700073%2C700074%2C700082%2C700083%2C700092%7D%2C0))%2C%22Jenn%22%2C%22%22%0A))))))))))%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Ewhich%20on%20dynamic%20array%20(DA)%20Excel%20returns%20correct%20results%20into%20the%20column%20B.%3C%2FP%3E%0A%3CP%3EIf%20put%20constants%20into%20the%20helper%20range%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20716px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167346iF036B897ECB823E4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Esame%20formula%20could%20be%20transformed%20to%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%24H%241%3A%24U%241%2C0))%2C%22Jackie%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%24H%242%3A%24U%242%2C0))%2C%22Frezell%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%24H%243%3A%24U%243%2C0))%2C%22Erika%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%24H%244%3A%24U%244%2C0))%2C%22Arlesia%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%24H%245%3A%24U%245%2C0))%2C%22Scott%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%24H%246%3A%24U%246%2C0))%2C%22Jody%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%24H%247%3A%24U%247%2C0))%2C%22Anthony%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%24H%248%3A%24U%248%2C0))%2C%22Kandi%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%24H%249%3A%24U%249%2C0))%2C%22Latesha%22%2C%0AIF(%0A%20%20%20ISNUMBER(MATCH(A2%3AA1146%2C%24H%2410%3A%24U%2410%2C0))%2C%22Jenn%22%2C%22%22%0A))))))))))%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EOn%20DA%20Excel%20above%20formulas%20spill%20result%20down.%20On%20pre-DA%20Excel%20they%20could%20be%20used%20if%20select%20B2%3AB1145%20and%20in%20formula%20bar%20enter%20the%20formula%20as%20array%20one%2C%20i.e.%20with%20Ctrl%2BShift%2BEnter.%20Or%2C%20alternatively%2C%20use%20absolute%20reference%20in%20column%20A%20range%20(%24A%242%3A%24A%241146)%2C%20enter%20formula%20in%20B2%20and%20drag%20down.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20return%20names%20we%20may%20use%20in%20D2%20regular%20formula%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DIFNA(IF(A2%3D%22%22%2C%22%22%2C%0A%20%20%20%20%20INDEX(%24G%241%3A%24G%2410%2C%0A%20%20%20%20%20%20%20%20%20%20MATCH(SUMPRODUCT((%24H%241%3A%24Q%2410%3DA2)*ROW(%24H%241%3A%24Q%2410))%2C%0A%20%20%20%20%20%20%20%20%20%20ROW(%24G%241%3A%24G%2410)%2C%0A%20%20%20%20%20%20%20%20%20%200)))%2C%0A%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eand%20drag%20it%20down.%3C%2FP%3E%0A%3CP%3EOf%20course%2C%20already%20suggested%20VLOOKUP%20always%20works.%3C%2FP%3E%3C%2FLINGO-BODY%3E
pbjrex
Occasional Contributor

Hi and Help please!

Here's what I'm trying to accomplish but either get a spill error or just a general problem with the formula error. I'm basically asking that from the data in column A2:A1146 if it equals a certain number to put a name in column B. 

=IF(A2:A1146=(700047:700058:700059:700071:700086:700091)," Jackie", IF(A2:A1146=(700053:700057:700063:700076:700079), "Frezell", IF(A2:A1146=(700049:700051:700055:700062:700087:700090), "Erika", IF(A2:A1146=(700056:700068:700085:700094:700095:700096:700097:700098), "Arlesia", IF(A2:A1146=(700048:700050:700060:700061:700064:700070:700072:700077:700088:700089), "Scott", IF(A2:A1146=(700052:700054:700065:700066:700080), "Jody", IF(A2:A1146=(700103:700104:700106:700107:700108:700109:700110), "Anthony", IF(A2:A1146=(700093:700099:700100:700101:700102:700105:700111:700113), "Kandi", IF(A2:A1146=(700075:700078:700081:700084:700112:700114), "Latesha", IF(A2:A1146=(700067:700069:700073:700074:700082:700083:700092), "Jenn"))))))))))

8 Replies
Highlighted

@pbjrex 

With all that logic you might be best off creating a lookup table then run a VLOOKUP off of it.

Highlighted

@Patrick2788 surprisingly I do more If functions than I have VLookup. How would I initiate that? And thank you!

Highlighted

What you've written is a dynamic array formula--If excel is giving you a spill error, your formula wants to return a range and there are values in adjacent cells preventing it from doing so. Clear up some space around the cell your formula is in.

Do you mean that Jackie can be associated with 700047 or 70058, etc?

If so, you want to pop those inside the OR function. Also, remove the range and just leave A2 and drag the formula down column B.

IF(OR($A2=70047, $A2=70058), "Jackie",IF(OR($A2=70053,$A2=70057),"Frezell",IF(... this will solve your issue of the array formula and prevent spill errors. When you drag the formula down column B, A2 will change to A3 in the next row.

Highlighted

@pbjrex 

Sample attached. Hope this helps. Enjoy your weekend!

Highlighted

@shawb Thank you! I'll try this now!

Highlighted
any advice it there are too many arguments?
Highlighted
Thank you!
Highlighted

@pbjrex 

What the formula

=IF(
   A2:A1146=(700047:700058:700059:700071:700086:700091)," Jackie",
IF(
   A2:A1146=(700053:700057:700063:700076:700079), "Frezell",
IF(...

does it compares A2:A1146 with combines ranges from row 700047 to row 700058 plus from row 700059 to row 700071, etc. If such rows ranges in formula are paired, Excel with dynamic arrays returns huge resulting array (which has no sense in any case) for which is not enough space in the sheet to place. If not paired as for the second IF formula Excel simply says you try to use incorrect formula.

 

Bit more practical will be the formula

=IF(
   ISNUMBER(MATCH(A2:A1146,{700047,700058,700059,700071,700086,700091},0)),"Jackie",
IF(
   ISNUMBER(MATCH(A2:A1146,{700053,700057,700063,700076,700079},0)),"Frezell",
IF(
   ISNUMBER(MATCH(A2:A1146,{700049,700051,700055,700062,700087,700090},0)),"Erika",
IF(
   ISNUMBER(MATCH(A2:A1146,{700056,700068,700085,700094,700095,700096,700097,700098},0)),"Arlesia",
IF(
   ISNUMBER(MATCH(A2:A1146,{700048,700050,700060,700061,700064,700070,700072,700077,700088,700089},0)),"Scott",
IF(
   ISNUMBER(MATCH(A2:A1146,{700052,700054,700065,700066,700080},0)),"Jody",
IF(
   ISNUMBER(MATCH(A2:A1146,{700103,700104,700106,700107,700108,700109,700110},0)),"Anthony",
IF(
   ISNUMBER(MATCH(A2:A1146,{700093,700099,700100,700101,700102,700105,700111,700113},0)),"Kandi",
IF(
   ISNUMBER(MATCH(A2:A1146,{700075,700078,700081,700084,700112,700114},0)),"Latesha",
IF(
   ISNUMBER(MATCH(A2:A1146,{700067,700069,700073,700074,700082,700083,700092},0)),"Jenn",""
))))))))))

which on dynamic array (DA) Excel returns correct results into the column B.

If put constants into the helper range

image.png

same formula could be transformed to

=IF(
   ISNUMBER(MATCH(A2:A1146,$H$1:$U$1,0)),"Jackie",
IF(
   ISNUMBER(MATCH(A2:A1146,$H$2:$U$2,0)),"Frezell",
IF(
   ISNUMBER(MATCH(A2:A1146,$H$3:$U$3,0)),"Erika",
IF(
   ISNUMBER(MATCH(A2:A1146,$H$4:$U$4,0)),"Arlesia",
IF(
   ISNUMBER(MATCH(A2:A1146,$H$5:$U$5,0)),"Scott",
IF(
   ISNUMBER(MATCH(A2:A1146,$H$6:$U$6,0)),"Jody",
IF(
   ISNUMBER(MATCH(A2:A1146,$H$7:$U$7,0)),"Anthony",
IF(
   ISNUMBER(MATCH(A2:A1146,$H$8:$U$8,0)),"Kandi",
IF(
   ISNUMBER(MATCH(A2:A1146,$H$9:$U$9,0)),"Latesha",
IF(
   ISNUMBER(MATCH(A2:A1146,$H$10:$U$10,0)),"Jenn",""
))))))))))

On DA Excel above formulas spill result down. On pre-DA Excel they could be used if select B2:B1145 and in formula bar enter the formula as array one, i.e. with Ctrl+Shift+Enter. Or, alternatively, use absolute reference in column A range ($A$2:$A$1146), enter formula in B2 and drag down.

 

To return names we may use in D2 regular formula

=IFNA(IF(A2="","",
     INDEX($G$1:$G$10,
          MATCH(SUMPRODUCT(($H$1:$Q$10=A2)*ROW($H$1:$Q$10)),
          ROW($G$1:$G$10),
          0))),
"")

and drag it down.

Of course, already suggested VLOOKUP always works.

Related Conversations