IFS AND Function

%3CLINGO-SUB%20id%3D%22lingo-sub-2365295%22%20slang%3D%22en-US%22%3EIFS%20AND%20Function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2365295%22%20slang%3D%22en-US%22%3E%3CP%3EHey%20so%20I'm%20trying%20to%20create%20a%20column%20where%20depending%20on%20the%20amount%20of%20points%20a%20column%20would%20display%3C%2FP%3E%3CP%3ELevel%26nbsp%3B%201%2C%20Level%26nbsp%3B%202%2C%20Level%26nbsp%3B%203%3C%2FP%3E%3CP%3EThe%20point%20are%20distributed%3C%2FP%3E%3CP%3ELevel%201%20(0%20-%20219)%3C%2FP%3E%3CP%3ELevel%202%20(220%20-%20339)%3C%2FP%3E%3CP%3ELevel%203%20(340%20-%20480)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20tried%20using%26nbsp%3B%3CSPAN%3E%3DIF(AND(C2%26gt%3B%3D1%2CC2%26lt%3B-219%22Level%201%22)%20but%20it's%20not%20executing.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EPlease%20help%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F636579%22%20target%3D%22_blank%22%3E%40amit_bhola%3C%2FA%3E%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B(%20i%20tagged%20you%20both%26nbsp%3Bbecause%20you%20gave%20really%20detailed%20answers%20on%20other%20issues)%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2365295%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-2365364%22%20slang%3D%22en-US%22%3ERe%3A%20IFS%20AND%20Function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2365364%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1057016%22%20target%3D%22_blank%22%3E%40Ade_On360%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DLOOKUP(C2%2C%7B0%2C220%2C340%7D%2C%7B%22Level%201%22%2C%22Level%202%22%2C%22Level%203%22%7D)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOr%20create%20a%20lookup%20table%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22S0420.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F281589i22780F1B72ABDF6A%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22S0420.png%22%20alt%3D%22S0420.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eand%20use%20%3DVLOOKUP(C2%2C%24J%242%3A%24K%244%2C2)%3C%2FP%3E%0A%3CP%3E%E2%80%83%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2367629%22%20slang%3D%22en-US%22%3ERe%3A%20IFS%20AND%20Function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2367629%22%20slang%3D%22en-US%22%3EHey%20ive%20tried%20using%20the%20lookup%20table%20but%20it%20gives%20an%20error%20message.%20maybe%20cause%20it%20needs%20to%20be%20within%20the%20ranges%20and%20not%20just%20a%20match%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2367653%22%20slang%3D%22en-US%22%3ERe%3A%20IFS%20AND%20Function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2367653%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1057016%22%20target%3D%22_blank%22%3E%40Ade_On360%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20value%20in%20J4%20in%20the%20screenshot%20should%20have%20been%20340%20instead%20of%20240%2C%20but%20the%20formula%20should%20work.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22S0422.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F281800i90915E745821096F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22S0422.png%22%20alt%3D%22S0422.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ESee%20the%20attached%20sample%20workbook.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2376603%22%20slang%3D%22en-US%22%3ERe%3A%20IFS%20AND%20Function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2376603%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1057016%22%20target%3D%22_blank%22%3E%40Ade_On360%3C%2FA%3E%26nbsp%3BHi%2C%20just%20for%20the%20academic%20purpose%2C%20if%20it%20is%20to%20be%20done%20using%20IF%20and%20AND%2C%20then%20the%20solution%20is%20as%20below%2Fattached.%20Take%20care%20to%20close%20the%20bracket%20for%20AND%20function%20within%20IF%20function.%20When%20a%20function%20is%20used%20within%20another%20function%2C%20its%20bracket%20needs%20to%20be%20closed%20each%20time.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20yes%2C%20the%20lookup%20table%20method%20using%20VLOOKUP%20is%20recommended%20instead%20of%20IF%20function%20for%20no.%20of%20levels%20beyond%20two.%20Lookup%20method%20is%20easy%20to%20understand%20and%20it%20is%20also%20easy%20to%20manage%20the%20change%20of%20level%20defining%20numbers%20by%20just%20typing%20the%20new%20values%20into%20the%20lookup%20table%20cells.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DIF(AND(C2%26gt%3B%3D0%2CC2%26lt%3B220)%2C%22Level%201%22%2CIF(AND(C2%26gt%3B%3D220%2CC2%26lt%3B340)%2C%22Level2%22%2CIF(AND(C2%26gt%3B%3D340%2CC2%26lt%3B%3D480)%2C%22Level3%22%2C%22Level%20not%20defined%22)))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hey so I'm trying to create a column where depending on the amount of points a column would display

Level  1, Level  2, Level  3

The point are distributed

Level 1 (0 - 219)

Level 2 (220 - 339)

Level 3 (340 - 480)

 

I've tried using =IF(AND(C2>=1,C2<-219"Level 1") but it's not executing.

Please help

 

@amit_bhola    @Sergei Baklan ( i tagged you both because you gave really detailed answers on other issues)

4 Replies

@Ade_On360 

 

=LOOKUP(C2,{0,220,340},{"Level 1","Level 2","Level 3"})

 

Or create a lookup table:

 

S0420.png

 

and use =VLOOKUP(C2,$J$2:$K$4,2)

Hey ive tried using the lookup table but it gives an error message. maybe cause it needs to be within the ranges and not just a match?

@Ade_On360 

The value in J4 in the screenshot should have been 340 instead of 240, but the formula should work.

S0422.png

See the attached sample workbook.

@Ade_On360 Hi, just for the academic purpose, if it is to be done using IF and AND, then the solution is as below/attached. Take care to close the bracket for AND function within IF function. When a function is used within another function, its bracket needs to be closed each time.

 

And yes, the lookup table method using VLOOKUP is recommended instead of IF function for no. of levels beyond two. Lookup method is easy to understand and it is also easy to manage the change of level defining numbers by just typing the new values into the lookup table cells.

 

=IF(AND(C2>=0,C2<220),"Level 1",IF(AND(C2>=220,C2<340),"Level2",IF(AND(C2>=340,C2<=480),"Level3","Level not defined")))