Excel制作随机点名

使用方法:

在A列下填写人物名字,按f9刷新后,随机抽取一个人。

具体实现:

在其他单元格写

1
=INDEX(A:A,RANDBETWEEN(2,COUNTA(A:A)))

函数解释:

1
=INDEX(A:A,RANDBETWEEN(2,COUNTA(A:A)))

A:A表示A列

COUNTA()可以统计区域内非空元素个数

RANDBETWEEN (bottom,top)从[bottom,top]随机返回一个整数

INDEX(Range,index)返回range范围内id为index的单元格内容。

首先用counta获取A这一列一共有多少数据,然后用randbetween(由于第一行是标题因此是从2开始,Excel是从1计数)从这些数据中获取一个值,用index从a列中选中随机值对应的单元格数据返回。

  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2022-2023 Junto
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信