![]() |
nesting if statements
OK let me try to explain this one...
Cell A1 has a number between 0 and 75. Cell A2 needs to have some nested If statements that reflect the following: If A1 is between 2 and 4 then A2 should read 80 If A1 is between 5 and 14 then A2 should read 120 If A1 is between 15 and 24 then A2 should read 160 If A1 is 25 and higher then A2 should read 200 |
Try...
=LOOKUP(A1,{2,5,15,25},{80,120,160,200}) Hope this helps! In article , tjb wrote: OK let me try to explain this one... Cell A1 has a number between 0 and 75. Cell A2 needs to have some nested If statements that reflect the following: If A1 is between 2 and 4 then A2 should read 80 If A1 is between 5 and 14 then A2 should read 120 If A1 is between 15 and 24 then A2 should read 160 If A1 is 25 and higher then A2 should read 200 |
Hi!
A couple of questions: What if A1 is <=2 ? between 2 and 4 between 5 and 14 between 15 and 24 Do you really mean: =2 and <=4 =5 and <=14 =15 and <=24 Biff "tjb" wrote in message ... OK let me try to explain this one... Cell A1 has a number between 0 and 75. Cell A2 needs to have some nested If statements that reflect the following: If A1 is between 2 and 4 then A2 should read 80 If A1 is between 5 and 14 then A2 should read 120 If A1 is between 15 and 24 then A2 should read 160 If A1 is 25 and higher then A2 should read 200 |
=IF(AND(A12,A1<4),80,IF(AND(A15,A1<14),120,IF(AN D(A115,A1<24),160,IF(A125,200))))
Yoou used "between" and so that is how I set up the formulas... In other words, the following inputs in A2 give the following results: 1 = FALSE 2 = FALSE 3 = 80 You may want to set up a table that allows you to link the formulas so that you can easliy change the values... Jim "tjb" wrote: OK let me try to explain this one... Cell A1 has a number between 0 and 75. Cell A2 needs to have some nested If statements that reflect the following: If A1 is between 2 and 4 then A2 should read 80 If A1 is between 5 and 14 then A2 should read 120 If A1 is between 15 and 24 then A2 should read 160 If A1 is 25 and higher then A2 should read 200 |
Good evening tjb You haven't indicated wha is to happen if the number in cell A1 is 0 or 1 - in the example below, 0 is returned. Other than that I think it covers your requirements. =IF(A1=25,200,IF(A1=15,160,IF(A1=5,120,IF(A1=2 ,80,0)))) HTH DominicB -- dominicb ------------------------------------------------------------------------ dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932 View this thread: http://www.excelforum.com/showthread...hreadid=466423 |
All times are GMT +1. The time now is 02:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com