+ Reply to Thread
Results 1 to 3 of 3

Return certain values by certain intervals in a cell

  1. #1
    Registered User
    Join Date
    02-28-2010
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    1

    Return certain values by certain intervals in a cell

    Hello,

    I have a question. My problem is that I have to generate a table in excel. In my columns I have to insert in the cells certain values by certain intervals.

    For example, if i have a column of numbers generated using the RAND() function, i need to insert in my cell 0 if the rand number is <=0.2; 1 if the number is between (0.2;0.6]; 2 if the no. is between (0.6;0.9] and 3 if (0.9;1].

    What function should i use and how. I tried with multiple IF's but with no success.


    Thank you.

    Robert.

  2. #2
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Return certain values by certain intervals in a cell

    Hi,

    Assuming your randomized cells are A1:A10 > in cell B1 type:

    =IF(A1<=0.2,0,IF(AND(A1>0.2,A1<=0.6),1,IF(AND(A1>0.6,A1<=0.9),2,IF(AND(A1>0.9,A1<=1),3,""))))

    OR:

    =0*(A1<=0.2)+1*(AND(A1>0.2,A1<=0.6)+(2*(AND(A1>0.6,A1<=0.9))+3*(AND(A1>0.9,A1<=1))))

    and copy down until B10

    Elm
    Last edited by ElmerS; 02-28-2010 at 02:06 PM.

  3. #3
    Valued Forum Contributor
    Join Date
    10-06-2008
    Location
    Norway
    MS-Off Ver
    2010
    Posts
    365

    Re: Return certain values by certain intervals in a cell

    Two other possibilities:
    B1: =IF(A1>1,"",LOOKUP(A1,{0,0.2,0.6,0.9},{0,1,2,3}))
    B1: =IF(A1<0.2,0,IF(A1<0.6,1,IF(A1<0.9,2,IF(A1<=1,3,""))))

+ 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