Excel formula if between x and y

Solved
Clairettededi -  
 Ben -
Hello,

I'm having difficulty using the IF formula in Excel 2003. Specifically, I would like to apply: if age is between 12 and 16 = fee of 255, if age is between 6 and 11 = fee of 133, and if age is under 5 = fee of 0.

I tried to apply the following formula: =IF((12>=J21<=16),255,IF((6>=J21<=11),131,0)) knowing that J21 is the child's age, but I'm not getting any result. Can you help me please?

Thanks in advance

Configuration: Windows XP / Internet Explorer 8.0

1 answer

  1. Ricky38 Posted messages 5776 Registration date   Status Contributor Last intervention   1 463
     
    Hi,

    =IF(J21="","",IF(J21<6,0,IF(J21<12,133,IF(J21<=16,255,""))))
    --
    Every problem has a solution... you just have to be persistent.
    19
    1. Clairettededi
       
      Thank you very much for this solution.
      0
    2. Timiii
       
      Is it possible to use the same formula for 8 values? I tried to modify this one but it doesn't work.
      0
    3. via55
       
      It's better to use VLOOKUP for multiple values
      For example:
      Let’s say the 2 columns are
      A B
      0 rate 1
      5 rate 2
      10 rate 3
      etc
      in A the limits of the age ranges and in B the corresponding rates
      If in C1 we enter an age, for example 6, with in C2 the following formula
      VLOOKUP(C1, A1:B4, 2, TRUE) where A1:B24 is the range where to find the data
      C2 will then display rate 2.
      0
    4. Ben
       
      Thank you
      0