+ Reply to Thread
Results 1 to 4 of 4

one number from multiple columns

  1. #1
    Registered User
    Join Date
    06-02-2010
    Location
    n.ireland
    MS-Off Ver
    Excel 2007
    Posts
    91

    one number from multiple columns

    Hello,

    I have data in columns A2:DK31 and growing,
    what i need is to pick a random number from 3 columns ei column A,E,AF.
    I know i can use
    =index(a2:a31,randbetween(2,31)) to get a random number from column A

    but how do i add in column E,AF to this and still return just 1 random number.
    Each day there is a new column added and each day he looks for a different combination.

    any help is fantastic.
    Last edited by dealer; 08-20-2010 at 06:37 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: one number from multiple columns

    =index(a2:af31,randbetween(1,30),choose(randbetween(1,3),1,5,32))

  3. #3
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: one number from multiple columns

    =index(a2:a31,randbetween(2,31))
    Would not work as you hope... it would never return the entry in a2 and would error out 1 in 31 times (looking for item 31 in a list of 30 items).

    Index can take an argument for a row and a column - it gives you a hint about this when you type =index(

    Something like this would work:
    =index(a2:dk31,randbetween(1,rows(a2:dk31)),randbetween(1,columns(a2:dk31)))

    this could be improved further, let us know how it goes

    PS, um, WHER paid more attention than me...

    =index(a2:af31,randbetween(1,rows(a2:af31)),choose(randbetween(1,3),1,5,32)))
    Last edited by Cheeky Charlie; 08-20-2010 at 05:33 AM.
    CC


    If you feel really indebted please consider a donation to charity. My preferred charity is ActionAid but there are plenty of worthy alternatives.

  4. #4
    Registered User
    Join Date
    06-02-2010
    Location
    n.ireland
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: one number from multiple columns

    Thanks Wher & Cheeky charlie,

    Your solutions work great,till the next time.

+ 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