+ Reply to Thread
Results 1 to 5 of 5

nesting if statements

  1. #1
    tjb
    Guest

    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

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    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

  3. #3
    Domenic
    Guest

    Re: nesting if statements

    Try...

    =LOOKUP(A1,{2,5,15,25},{80,120,160,200})

    Hope this helps!

    In article <[email protected]>,
    tjb <[email protected]> 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


  4. #4
    Biff
    Guest

    Re: nesting if statements

    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" <[email protected]> wrote in message
    news:[email protected]...
    > 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




  5. #5
    TN.Jim
    Guest

    RE: nesting if statements

    =IF(AND(A1>2,A1<4),80,IF(AND(A1>5,A1<14),120,IF(AND(A1>15,A1<24),160,IF(A1>25,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


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1