跳到主要內容

如何在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

Excel的Kutools - 使用 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中生成彩票號碼。

Excel的Kutools - 包含 300 多個 Excel 基本工具。 享受全功能 30 天免費試用,無需信用卡! 現在下載!

1。 選擇6個相鄰的單元格,例如A1:F1,然後單擊 庫工具 > 插入 > 插入隨機數據.

2。 現在,出現“插入隨機數據”對話框。 轉到 整型 標籤,輸入 1 in 框,鍵入 49 in 框,選中 獨特價值 選項,然後單擊 OK 按鈕。 現在,您將看到6個唯一的彩票號碼已生成並立即顯示在所選單元格中。

Excel的Kutools - 使用 300 多種基本工具增強 Excel 功能。 享受全功能 30 天免費試用,無需信用卡! 立即行動吧!


演示:使用Kutools for Excel生成彩票號碼


Excel的Kutools:超過 300 個方便的工具觸手可及! 立即開始 30 天免費試用,沒有任何功能限制。 現在就下載!

相關文章:

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為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