[Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register]

Author Message
fivefootnine
Power User

Joined: 09 Apr 2012
Posts: 60

 Posted: Sun Jun 17, 2012 8:17 am    Post subject: [SOLVED]Random picks from Row I have a row (A1-T1) consisting of 20 numbers, and would like to randomly pick 5 of those into another row (A2-E2), how would I do that? thanks for any answer and have a great day!Last edited by fivefootnine on Mon Jun 18, 2012 12:55 am; edited 1 time in total
Villeroy
Super User

Joined: 04 Oct 2004
Posts: 10081
Location: Germany

 Posted: Sun Jun 17, 2012 8:31 am    Post subject: Get another row of 20 cells, fill them with =RAND(), say AA1:AT1 some cell: =INDEX(\$A\$1:\$T\$1 ; 1; RANK(AA\$1 ; \$AA\$1:\$AT\$1)) [EDIT: fixed version] copy to the right, hit F9 to refresh RAND generates 10 different values in \$AA\$1:\$AT\$1 RANK(AA\$1;\$AA\$1:\$AT\$1) gives the rank of AA1 within the array of randoms. When copied to the right we get 20 ranks between 1 and 20 in random order because the input values are random. The index function gets a value from the original data at the position of the random ranking._________________Rest in peace, oooforum.org Get help on http://forum.openoffice.orgLast edited by Villeroy on Mon Jun 18, 2012 7:24 am; edited 2 times in total
fivefootnine
Power User

Joined: 09 Apr 2012
Posts: 60

 Posted: Sun Jun 17, 2012 9:59 am    Post subject: Thank you for your answer, it doesnt quite work though. I´m doing exactly as you wrote but I´m getting the #VALUE! in the cells where I put the code.??
Villeroy
Super User

Joined: 04 Oct 2004
Posts: 10081
Location: Germany

 Posted: Sun Jun 17, 2012 10:31 am    Post subject: I made a mistake. Try the fixed formula._________________Rest in peace, oooforum.org Get help on http://forum.openoffice.org
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 8 Hours Page 1 of 1

 Jump to: Select a forum OpenOffice.org Forums----------------Setup and TroubleshootingOpenOffice.org WriterOpenOffice.org CalcOpenOffice.org ImpressOpenOffice.org DrawOpenOffice.org MathOpenOffice.org BaseOpenOffice.org Macros and APIOpenOffice.org Code Snippets Community Forums----------------General DiscussionSite Feedback
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum