跳到主要内容

如何在Excel中生成彩票号码?

您是否曾经想过在Excel中生成彩票号码,或者自己在Excel中生成彩票号码生成器? 在本文中,我提供了三种方法可以轻松完成它。


使用Excel函数生成彩票号码

此方法将指导您应用几个Excel函数来生成彩票号码。 您可以执行以下操作:

1。 在空白工作表中,在范围A1:C1中键入列标题,如下图所示:

2。 在A列,B列和C列中输入公式:

(1)在单元格A2中,输入公式 = RAND(),然后将“填充”手柄拖动到范围A2:A50。
(2)在单元格B2中,输入公式 =RANK($A2,$A$2:$A$50)+COUNTIF(B$1:B1,B1)-1,然后将“填充手柄”拖动到范围B2:B50。 (在公式中,A2是当前单元格剩余的随机数,$ A $ 2:$ A $ 50都是我们在第一个公式中获得的所有随机数,B $ 1是B列中的第一个单元格,B1是当前单元格上方的单元格细胞)。
(3)在范围C2:C50中,输入1到49之间的序列号。

然后,您将获得一个表格,如左图所示:

 

注意丝带 公式太难记了吗? 将公式另存为自动文本条目,以供日后再次使用!
阅读全文...     免费试用

3。 找到一个空白范围,在下面的屏幕截图中,连续水平输入序列号:

4。 在第一个序列号1下方,输入公式 = VLOOKUP(G1,$ B $ 1:$ C $ 50,2,FALSE) 放入其中,然后将“填充手柄”拖动到所需的范围。

备注:在此公式中,G1是第一个序列号为1的单元格,$ B $ 1:$ C $ 50是“唯一排名”列和“球数”列,2表示在范围$ B $ 1:$ C $ 50的第二列中查找值。

然后您将获得如下所示的彩票号码:

5。 它是可选的。 为防止彩票号码在当前工作表刷新时自动更改,可以单击 公式 > 计算选项 > 用户手册.

轻松列出Excel中几个系列数据的所有组合

Kutools for Excel的 列出所有组合 该实用程序旨在汇总来自几个给定系列数据的所有可能组合,并在下面的屏幕快照中列出这些组合。


列出所有组合1

Kutools for Excel - 使用 300 多种基本工具增强 Excel 功能。 享受全功能 30 天免费试用,无需信用卡! 立即行动吧!

使用VBA宏生成彩票号码

此方法将指导您应用VBA宏在Excel中生成彩票号码。 请执行以下操作:

1。 按 其他 + F11 键以打开“ Microsoft Visual Basic应用程序”窗口。

2。 点击 插页 > 模块 打开一个新的模块窗口,并将以下VBA代码粘贴到其中:

VBA:Excel中的彩票号码生成器

Sub LotteyCode()
Dim Rng As Range
Dim WorkRng As Range
Dim xNumbers(49) As Integer
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Out put to (single cell):", xTitleId, WorkRng.Address, Type:=8)
Set WorkRng = WorkRng.Range("A1")
For xIndex = 1 To 49
xNumbers(xIndex) = xIndex
Next
For xIndex = 1 To 6
xNum = 1 + Application.Round(Rnd * (49 - xIndex), 0)
WorkRng.Offset(0, xIndex - 1).Value = xNumbers(xNum)
xNumbers(xNum) = xNumbers(50 - xIndex)
Next
End Sub

3。 按 F5 键或单击 运行 按钮以运行此VBA宏。

4。 现在,在弹出的对话框中,指定一个单元格以输出彩票号码,然后单击 OK 按钮。

然后,您将看到6个唯一的彩票号码已生成并显示在指定的单元格中。


使用 Kutools for Excel 生成彩票号码

如果您安装了 Kutools for Excel, 插入随机数据 实用程序可以帮助您立即在Excel中生成彩票号码。

Kutools for Excel - 包含 300 多个 Excel 基本工具。 享受全功能 30 天免费试用,无需信用卡! 现在下载!

1。 选择6个相邻的单元格,例如A1:F1,然后单击 库工具 > 插页 > 插入随机数据.

2。 现在,出现“插入随机数据”对话框。 转到 整数 标签,输入 1 in 框中键入 49 in 框,选中 独特价值 选项,然后单击 OK 按钮。 现在,您将看到6个唯一的彩票号码已生成并立即显示在所选单元格中。

Kutools for Excel - 使用 300 多种基本工具增强 Excel 功能。 享受全功能 30 天免费试用,无需信用卡! 立即行动吧!


演示:使用 Kutools for Excel 生成彩票号码


Kutools for Excel:超过 300 个方便的工具触手可及! 立即开始 30 天免费试用,没有任何功能限制。 立即下载!

相关文章:

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (15)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
the system dont work ,what is wrong i have inserted all the formular
This comment was minimized by the moderator on the site
The file does not work with the fromula ,what is wronG

please let me know

i copy the formular all is correct .
This comment was minimized by the moderator on the site
Hi there,

Could you please attach the file you are working?

Amanda
This comment was minimized by the moderator on the site
Thank you Amanda for your assistance.
This comment was minimized by the moderator on the site
Yes 25 numbers from 1 to 49.
I have tried using the same formula but once a number bigger than 25 is picked the next number in the sequence cannot be shown and error occurs.
Rated 5 out of 5
This comment was minimized by the moderator on the site
Hi I have tried the Vlookup way that you shown here it works great and it is easy to generate the numbers for the 1 to 49 range.

But I was thinking of eliminating some numbers in play like for example instead of running numbers I will have 25 numbers from 1 to 49. How will I need to adjust the Vlookup formula to make it work?
Rated 5 out of 5
This comment was minimized by the moderator on the site
Hi Yogi, sorry I don't quite understand your request. What do you mean by having 25 numbers from 1 to 49?
This comment was minimized by the moderator on the site
What is the purpose of COUNTIF(B$1:B1,B1)-1 in the formula in step B?
This comment was minimized by the moderator on the site
Hi hyungsup kim,
COUNTIF(B$1:B1,B1)-1 will prevent duplicates in the Column B. For example, if the B1 is a unique value, this part will return 0 which won’t affect the ranking result; if the B1 is duplicate, this part will adjust the ranking result slightly.
This comment was minimized by the moderator on the site
calculate the next day lottery number for kerala lottery - india
This comment was minimized by the moderator on the site
calculate the next day guess for kerala lottery
This comment was minimized by the moderator on the site
hay, Santhanam did you every win with this program?
This comment was minimized by the moderator on the site
: I would like to try your new programs see how the numbers predict
This comment was minimized by the moderator on the site
I will like to win some luck number
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations