OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[SOLVED]Random picks from Row

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
fivefootnine
Power User
Power User


Joined: 09 Apr 2012
Posts: 60

PostPosted: Sun Jun 17, 2012 8:17 am    Post subject: [SOLVED]Random picks from Row Reply with quote

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
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10065
Location: Germany

PostPosted: Sun Jun 17, 2012 8:31 am    Post subject: Reply with quote

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.org


Last edited by Villeroy on Mon Jun 18, 2012 7:24 am; edited 2 times in total
Back to top
View user's profile Send private message
fivefootnine
Power User
Power User


Joined: 09 Apr 2012
Posts: 60

PostPosted: Sun Jun 17, 2012 9:59 am    Post subject: Reply with quote

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.??
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10065
Location: Germany

PostPosted: Sun Jun 17, 2012 10:31 am    Post subject: Reply with quote

I made a mistake. Try the fixed formula.
_________________
Rest in peace, oooforum.org
Get help on http://forum.openoffice.org
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group