简体   繁体   中英

Generate random item from list Excel 2003

I have a list of names in cells A1:A100, and I'm looking for a formula to enter into a cell that will select a random name from that range. I have spent much time searching to no avail, all solutions seem to be derived from the RANDBETWEEN function which is not part of Excel 2003, but only newer versions. This seems like a very common thing to want to do so I'm really surprised there is no easy-to-find solution. Help is much appreciated =)

If you can't use RandBetween(), you can still use Rand(), which delivers a decimal number. Round the decimal number to 2 places, then multiply by 100 to get a number between 0 and 99. Add 1 to get a number between 1 and 100

=(ROUND(RAND(),2)*100)+1

Feed that into an Index function like this

=Index(A1:A100,(ROUND(RAND(),2)*100)+1)

Done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM