Help writing a Apple Numbers Spreadsheet embedded IF function that test 5 conditions and returns 5 values.

=IF(R2>0,<2,”2”,IF(R2>1,<3,”4”,IF(R2>2,<4,”6”,IF(R2>3,<5,”8”,IF(R2>,4<5,”10”)))))

m

I’’m trying to write a Apple Numbers Spreadsheet formula that embeds the IF function  to test 5 different conditions.  =IF(R2 is 1 then assign the value “2”, Else IF(R2 is 2, then assign the value “4” else IF(R2 is 3 then assign the value “6” else IF(R2 is 4 then assign the value “8” else IF(R2 is 5, then assign the value of “10”)))))  


I continue to get syntax errors.  I would appreciate help with my syntax errors and actually seeing the proper syntax to make this work. Moreover, I am open to a welcoming a more efficient way to to achieve the overall goal stated above.

MacBook Pro (3)

Posted on Jul 27, 2023 4:49 PM

Reply
3 replies

Jul 27, 2023 6:40 PM in response to tcwestover

If =R2*2 doesn't capture all your cases then you can use SWITCH or IFS, which are much easier than nested ifs.


To use SWITCH:


=SWITCH(R2,1,2,2,4,3,6,4,8,5,10)


This references R2 and is simply followed by switch-value, if-match pairs.


More on SWITCH here:


SWITCH - Apple Support


IFS is a similar idea, a little more complicated for this particular case, but useful for dealing with in inequalities (> and < , etc). In this case you could use this:


=IFS(R2=1,2,R2=2,4,R2=3,6,R2=4,8,R2=5,10)


More on IFS here:


IFS - Apple Support


Either way no need to get tangled up in logic of nested ifs.


SG

Help writing a Apple Numbers Spreadsheet embedded IF function that test 5 conditions and returns 5 values.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.