+ Reply to Thread
Results 1 to 9 of 9

REALLY long - want to pick a random value from a table, and random symbol

  1. #1
    Registered User
    Join Date
    07-17-2009
    Location
    Bristol England
    MS-Off Ver
    Excel 2007
    Posts
    46

    REALLY long - want to pick a random value from a table, and random symbol

    Hi,

    I have a long winded problem, attached. I have included what I need eventually in each column.

    Questions.xlsx

    I need to Create a 1000+ questions of this type.

    Anyone have any ideas how to randomly select a value from the table I2:1000,L2:1000.

    Also how do I make it randomly select a symbol? I want either plus, minus, multiply or divide in C2:1000 and E2:000.

    Thanks in advance
    Last edited by Geomarsh; 08-14-2009 at 11:22 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: REALLY long - want to pick a random value from a table, and random symbol

    Try:

    =INDEX($I$2:$L$1000,RANDBETWEEN(1,1000),RANDBETWEEN(1,4))

    for the symbols... list them in another column separately, say M2:M6

    then

    =INDEX($M$2:$M$6,RANDBETWEEN(1,6))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: REALLY long - want to pick a random value from a table, and random symbol

    for symbol id use
    =CHOOSE(RANDBETWEEN(1,4),"+","-","/","*")
    for
    sum use
    =MROUND((EVAL(B3&C3&D3&E3&F3)),10)
    mround needs analysis toolpak activated and eval needs morefunc addin
    http://xcell05.free.fr/morefunc/english/#Functions
    Last edited by martindwilson; 08-14-2009 at 08:47 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    07-17-2009
    Location
    Bristol England
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: REALLY long - want to pick a random value from a table, and random symbol

    Thanks will have a go!

  5. #5
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: REALLY long - want to pick a random value from a table, and random symbol

    Likely the solution provided by NBVC and martindwilson will serve your purpose, but you may be interested in taking a look at this thread in which a somewhat similar questions was asked.

    Get Random # of Range values

  6. #6
    Registered User
    Join Date
    07-17-2009
    Location
    Bristol England
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: REALLY long - want to pick a random value from a table, and random symbol

    Hi,
    The INDEX function worked fantastically, so did the CHOOSE for the symbols.
    When it comes to the answer, I need each number in the question rounded to the nearest integer,10,100 or 1000, not the actual answer itself (I've only just realised this). So I need a function that can count how many digits in the number, then round it to 1000.

    eg.
    323 x 22 / 2.9 = 300 x 20 / 3

    so 3 digit numbers are rounded to nearest 100, 2 digits to nearest 10, decimals to nearest integer.
    Maybe a count function or something?

    Thanks for your help!

  7. #7
    Registered User
    Join Date
    07-17-2009
    Location
    Bristol England
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: REALLY long - want to pick a random value from a table, and random symbol

    [QUOTE=Palmetto;2145794]Likely the solution provided by NBVC and martindwilson will serve your purpose, but you may be interested in taking a look at this thread in which a somewhat similar questions was asked.

    Brilliant, will have a go at this - am always willing to learn more at the moment - I'm just getting into it!

    Thanks

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: REALLY long - want to pick a random value from a table, and random symbol

    Quote Originally Posted by Geomarsh View Post
    Hi,
    The INDEX function worked fantastically, so did the CHOOSE for the symbols.
    When it comes to the answer, I need each number in the question rounded to the nearest integer,10,100 or 1000, not the actual answer itself (I've only just realised this). So I need a function that can count how many digits in the number, then round it to 1000.

    eg.
    323 x 22 / 2.9 = 300 x 20 / 3

    so 3 digit numbers are rounded to nearest 100, 2 digits to nearest 10, decimals to nearest integer.
    Maybe a count function or something?

    Thanks for your help!
    Try:

    =MROUND(B3,CHOOSE(LEN(INT(B3)),1,10,100,1000))*MROUND(D3,CHOOSE(LEN(INT(D3)),1,10,100,1000))/MROUND(F3,CHOOSE(LEN(INT(F3)),1,10,100,1000))

  9. #9
    Registered User
    Join Date
    07-17-2009
    Location
    Bristol England
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: REALLY long - want to pick a random value from a table, and random symbol

    Formulas are all perfect thanks guys!

+ 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