跳到主要內容

如何在Excel中隨機選擇單元格?

假設您在工作表中有一列值(A1:A15),現在您需要從中選擇5個隨機單元格,如何處理呢? 在本文中,我將向您展示一些在Excel中隨機選擇單元格的技巧。

從具有公式的列中隨機選擇單元格

從具有用戶定義函數(UDF)的列中隨機選擇單元格

使用Kutools for Excel從範圍內隨機選擇單元格 好主意3


箭頭藍色右氣泡 從具有公式的列中隨機選擇單元格

如以下屏幕截圖所示,您擁有從A1到A15的一系列數據, 蘭德Index 指數 公式可以幫助您在新列中顯示隨機單元格。 請執行以下操作:

文檔選擇單元格隨機1

1.在相鄰的單元格(例如B1)中,輸入公式 = RAND(), 並按下 Enter 鍵,然後將公式複製到單元格B15。 隨機值將用單元格填充。 看截圖:
文檔選擇單元格隨機2

2.然後在下一個單元格(在本例中為C1單元格)中,輸入公式 =INDEX($A$1:$A$15,RANK(B1,$B$1:$B$15)).
文檔選擇單元格隨機3

3.然後按 Enter 鍵,然後選擇單元格C1,拖動填充手柄以覆蓋所需選擇的單元格。 並且在列C中顯示了範圍為A5:A1的15個隨機單元。請參見屏幕截圖:
文檔選擇單元格隨機4


從Excel中的選擇快速隨機排序或選擇單元格/行/列

Kutools for Excel的隨機排序範圍 可以快速按單元格,列或行對數據進行隨機排序或選擇。 點選取得全功能 30 天免費試用!
doc隨機排序
doc隨機選擇
 
 Kutools for Excel:擁有300多個便捷的Excel加載項,可以在30天內免費試用。

箭頭藍色右氣泡 從具有用戶定義函數(UDF)的列中隨機選擇單元格

以下VBA代碼還可以幫助您顯示所需的隨機單元格。

1。 點擊 開發者 > Visual Basic中,一個新的 適用於應用程序的Microsoft Visual Basic 將顯示一個窗口,單擊 插入 > 模塊,然後將以下功能輸入到 模塊:

Function RandomSelection(aRng As Range)
'Update20131113
Dim index As Integer
Randomize
index = Int(aRng.Count * Rnd + 1)
RandomSelection = aRng.Cells(index).Value
End Function

2.然後關閉模塊窗口,並輸入此功能 = RandomSelection($ A $ 1:$ A $ 15) 在單元格B1中。 看截圖:
文檔選擇單元格隨機5

3。 按 Enter 鍵,並且B列中已顯示A1:A15的隨機值。然後拖動填充手柄以覆蓋所需選擇的單元格。文檔選擇單元格隨機6

以上兩種方法可以在新列中顯示隨機單元格值,並且它們僅適用於單個列範圍,不適用於一定範圍的單元格。 Kutools for Excel的``隨機排序範圍''工具可以幫助您方便地在原始範圍內隨機選擇單元格。


箭頭藍色右氣泡 使用Kutools for Excel從範圍內隨機選擇單元格

Excel的Kutools, 與以上 300 方便的功能,使您的工作更加輕鬆。 

免費安裝 Kutools for Excel,請執行以下操作:

1.選擇要使用的範圍。

2.單擊以應用該實用程序 庫工具 > 範圍 > 隨機排序/選擇範圍,請參見屏幕截圖:
doc隨機選擇1

3。 在裡面 隨機排序/選擇範圍 對話框,單擊 選擇 按鈕,然後輸入您要選擇的單元格的數量,然後選中 選擇類型 你需要。 然後點擊 OK or 應用。 見截圖:

從所選範圍中隨機選擇10個單元格
doc隨機選擇2

從所選範圍中隨機選擇5行
doc隨機選擇3

從所選範圍中隨機選擇4列
doc隨機選擇4

進階選擇隨機儲存格, 隨機排序範圍 of Excel的Kutools 可以在整個範圍,每一行,每一列等中對數據進行隨機排序。
doc隨機選擇5

箭頭藍色右氣泡 隨機選擇或排序範圍內的數據


輕鬆插入隨機數據,在一系列單元格中沒有重複項

如果您想在一系列單元格中插入隨機且沒有重複的整數,日期,時間或字符串,甚至是自定義列表,那麼論壇可能很難記住。 但 Kutools for Excel的插入器隨機數據 可以盡快輕鬆地處理這些工作。 單擊以獲取全部功能 30 天免費試用!
doc插入隨機數據
 
Kutools for Excel:擁有300多個便捷的Excel加載項,可以在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)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Как же я намучился, пока подбирал эту же формулу для русскоязычного Excel! Вот она: =ИНДЕКС(A:A;РАНГ(B1;B:B;1))
This comment was minimized by the moderator on the site
Very useful, but the format of the cells has been changed and also its showing few duplicate values. Please tell me how to get it solved.
This comment was minimized by the moderator on the site
Hi I am looking to build a grid with names on the left and dates (weeks) across the top. I then need to have a function that fills in random X's on particular weeks for all names. Is this possible
This comment was minimized by the moderator on the site
This one is just awesome! Exactly what I needed! Thanks!
This comment was minimized by the moderator on the site
How to select perecent of cells randomly and replace by a specific number?
This comment was minimized by the moderator on the site
Thanks. Was a great and quick help.
This comment was minimized by the moderator on the site
Thanks. Really was a great and quick help.
This comment was minimized by the moderator on the site
Wow!!! This is really amazing! Thanks a lot for these great tricks.
This comment was minimized by the moderator on the site
Great info, however on my "randomly selected cells" there are duplicates... how can I prevent that from happening? I need the random selection to return unique cells
This comment was minimized by the moderator on the site
to do this you will need to set up a random non repeating set of numbers I used this website to do it: http://support.microsoft.com/kb/213290
This comment was minimized by the moderator on the site
I would like to random select a document with 500 items. I want to select 10 percent. There are four columns in that document. Is there a way to do this?
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