+ Reply to Thread
Results 1 to 3 of 3

Excel 2007 : generating random numbers with exception

  1. #1
    Registered User
    Join Date
    05-15-2012
    Location
    india
    MS-Off Ver
    excel 2007
    Posts
    2

    generating random numbers with exception

    Dear all,
    I'd like to generate random numbers between -9 and 9. But I don't want 0. Is there a way?
    Thanks.
    Balaji

  2. #2
    Valued Forum Contributor
    Join Date
    05-07-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    354

    Re: generating random numbers with exception

    how about combining with an "IF" function

    =IF(RANDBETWEEN(0,1)=0,RANDBETWEEN(1,9),RANDBETWEEN(-9,-1))
    Last edited by vandan_tanna; 05-15-2012 at 01:01 PM.
    Regards,
    Vandan

  3. #3
    Registered User
    Join Date
    05-15-2012
    Location
    india
    MS-Off Ver
    excel 2007
    Posts
    2

    Re: generating random numbers with exception

    Thanks Vandan,
    It works fine. But I have more issues. I'm teaching abacus and I think of generating sums in excel. My task is
    imagine I want in cell A1=randbetween(1,9). This i can create. The problem is with Cell A2. Condition in A2 is
    If(A1=9), I must have randbetween(-9,-1) or a number from the list (-9,-8,-7,-6,-5,-4,-3,-2,-1)
    If(A1=8), I must have randbetween(-8,1)except 0,-4 or a number from the list (-8,-7,-6,-5,-3,-2,-1,1)
    If(A1=7), I must have randbetween(-7,2)except 0,-4,-3 or a number from the list (-7,-6,-5,-2,-1,1,2)
    If(A1=6), I must have randbetween(-6,3)except 0,-4,-3,-2 or a number from the list (-6,-5,-1,1,2,3)
    If(A1=5), I must have randbetween(-5,4)except 0,-4,-3,-2,-1 or a number from the list (-5,1,2,3,4)
    If(A1=4), I must have randbetween(-4,5)except 0,1,2,3,4 or a number from the list (-4,-3,-2,-1,5)
    If(A1=3), I must have randbetween(-3,6)except 0,2,3,4 or a number from the list (-3,-2,-1,1,5,6)
    If(A1=2), I must have randbetween(-2,7)except 0,3,4 or a number from the list (-2,-1,1,2,5,6,7)
    If(A1=1), I must have randbetween(-1,8)except 0,4 or a number from the list (-1,1,2,3,5,6,7,8)
    Any help would be of great help to me!
    Thanks,
    Regards,Balaji

+ 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