如何在Excel中生成某个范围内的随机整数
时间:2023-04-07 18:20:54
有时需要生成某个范围内随机整数,在Excel中可以使用RAND或RANDBETWEEN函数。
1.使用RAND函数。
RAND函数返回大于等于 0 及小于 1 的均匀分布随机实数,其语法是:
=RAND()
要生成某个范围内的随机整数,可以使用以下公式:
=INT((上限-下限+1)*RAND()+下限)
生成的随机整数中有可能包含上限或下限。例如要生成1-100之间的随机整数,在单元格中输入公式:
=INT(100*RAND()+1)
2.使用RANDBETWEEN函数
RANDBETWEEN函数可以直接返回位于指定的两个数之间的一个随机整数,其语法是:
RANDBETWEEN(bottom,top)
参数“bottom ”为指定的最小整数,参数“top”为指定的最大整数。如公式:
=RANDBETWEEN(1,100)
返回1-100之间的随机整数,可能包含1或100。
在Excel 2003中,RANDBETWEEN函数不能直接使用,需要加载分析工具库后才能使用。方法是:单击菜单“工具→加载项”,在弹出的“加载项”对话框中勾选“分析工具库”,单击“确定”即可。而在Excel 2007中RANDBETWEEN函数可以直接使用。
标签:函数,整数,生成,随机,Excel函数
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
wps条件格式
2022-10-10 22:43:42
![](https://img.aspxhome.com/file/2023/8/a169288_0s.jpg)
怎么让wps office自动编号?
2023-01-26 21:46:59
![](https://img.aspxhome.com/file/2023/0/a168090_0s.jpg)
excel中如何拆分单元格 填充excel自选图形样式
2023-01-29 09:16:40
![](https://img.aspxhome.com/file/2023/3/a154273_0s.jpg)
word2007组合或取消组合形状或对象
2023-12-09 11:07:23
![](https://img.aspxhome.com/file/2023/9/19839_0s.jpg)
excel表格如何横向求积
2023-05-15 13:38:49
网上数据怎样导入wps表格中
2023-04-09 19:45:22
excel怎么使用countblank函数统计空白单元格个数?
2022-10-21 11:15:40
![](https://img.aspxhome.com/file/2023/5/a141635_0s.jpg)
PPT怎么设计循环关系图表? ppt循环图表的制作方法
2022-06-04 02:22:22
![](https://img.aspxhome.com/file/2023/10/a346055_0s.jpg)
Excel2010中怎么插入迷你图
2023-05-31 15:01:47
![](https://img.aspxhome.com/file/2023/7/38557_0s.jpg)
打开steam商店提示错误代码103的解决方法
2022-11-24 22:04:03
![](https://img.aspxhome.com/file/2023/3/a295610_0s.jpg)
苹果发布 macOS Ventura 13.3 正式版更新:新増21种表情符号
2023-11-20 04:08:58
![](https://img.aspxhome.com/file/2023/10/a344032_0s.jpeg)
Win7笔记本电脑怎么当显示器用?笔记本电脑当显示器用的方法
2022-08-09 16:27:40
![](https://img.aspxhome.com/file/2023/26/a228512_0s.png)
Visio 2007产品密钥大全 Visio 2007序列号分享
2022-07-07 06:01:13
![](https://img.aspxhome.com/file/2023/8/a340233_0s.jpg)
外置声卡怎么连接电脑_外置声卡连接电脑的方法
2023-09-14 01:12:54
![](https://img.aspxhome.com/file/2023/4/a309366_0s.png)
微软用户名怎么更改
2023-02-28 07:43:51
![](https://img.aspxhome.com/file/2023/9/a342768_0s.png)
Excel如何调试公式呢?
2023-03-01 03:52:52
![](https://img.aspxhome.com/file/2023/5/40985_0s.jpg)
Excel中进行设置表格行高列宽的操作技巧
2023-11-23 22:24:12
WPS 如何在word文档中的任意地方输入文字
2022-05-08 12:32:59
![](https://img.aspxhome.com/file/2023/6/a185646_0s.jpg)
Win10专业版如何关闭安全中心?
2023-11-25 02:42:59
![](https://img.aspxhome.com/file/2023/26/a223573_0s.png)
WPS怎么画一个圆角三角形?
2023-01-15 11:22:30
![](https://img.aspxhome.com/file/2023/5/a167385_0s.png)