メインコンテンツへスキップ

Excelで重複せずに乱数を生成するにはどうすればよいですか?

多くの場合、Excelで乱数を生成したいですか? ただし、数値をランダム化する一般的な数式では、値が重複する場合があります。 ここでは、Excelで重複することなく乱数を生成するためのいくつかの秘訣を説明します。

数式を使用して一意の乱数を生成する

Kutools for ExcelのInsertRandom Dataを使用して一意の乱数を生成します(簡単です!) 良いアイデア3


矢印青い右バブル 数式を使用して一意の乱数を生成する

Excelで一意の乱数を生成するには、XNUMXつの数式を使用する必要があります。

1。 列Aと列Bに重複のない乱数を生成する必要があるとします。次に、セルE1を選択し、この数式を入力します。 = RAND()、次にプレス 入力します キー、スクリーンショットを参照してください:
doc-randomize-no-repeat-1

2.を押して、列E全体を選択します。 Ctrlキー + スペース キーを同時に押してから、 Ctrlキー + D 式を適用するためのキー = RAND() 列E全体に。スクリーンショットを参照してください。
doc-randomize-no-repeat-2

3.次に、セルD1に、必要な乱数の最大数を入力します。 この場合、1から50の間で繰り返さずに乱数を挿入したいので、D50に1と入力します。
doc-randomize-no-repeat-3

4.次に列Aに移動し、セルA1を選択して、この数式を入力します =IF(ROW()-ROW(A$1)+1>$D$1/2,"",RANK(OFFSET($E$1,ROW()-ROW(A$1)+(COLUMN()-COLUMN($A1))*($D$1/2),),$E$1:INDEX($E$1:$E$1000,$D$1)))、次にフィルハンドルを次の列Bにドラッグし、フィルハンドルを必要な範囲までドラッグします。 スクリーンショットを参照してください:
doc-randomize-no-repeat-4

さて、この範囲では、必要な乱数は繰り返されません。

注:

1.上記の長い数式で、A1は長い数式を使用するセルを示し、D1は乱数の最大数を示し、E1は数式= RAND()を適用する列の最初のセルであり、2は挿入することを示します。 XNUMX列に乱数。 必要に応じて変更できます。

2.すべての一意の番号が範囲内に生成されると、冗長セルは空白として表示されます。

3.この方法では、1から始まる乱数を生成できます。ただし、XNUMX番目の方法では、乱数の範囲を簡単に指定できます。


矢印青い右バブル Kutools forExcelのInsertRandomDataを使用して一意の乱数を生成します

上記の式では、処理するのに非常に不便があります。 しかし、 Kutools for Excelさん ランダムデータを挿入 この機能を使用すると、必要に応じて一意の乱数をすばやく簡単に挿入できるため、時間を大幅に節約できます。

時間は短くても生産性は高い

Excel 300 ~ 2019 用の 2003 以上のプロフェッショナル ツールが含まれています
最初のバージョン1.0は2011年にリリースされましたが、現在はバージョン18.0です。
ほとんどのExcelの毎日の複雑なタスクを数秒で解決し、時間を節約します
制限なしの30日間の無料トライアル

kteパッケージ盒

インストールした後 Kutools for Excel、以下のようにしてください:(今すぐExcel用のKutoolsを無料でダウンロードしてください!)

1.乱数を生成するために必要な範囲を選択し、をクリックします クツール > インセット > ランダムデータを挿入。 スクリーンショットを参照してください:

2。 の中に ランダムデータを挿入 ダイアログで 整数 タブで、必要な番号範囲を & テキストボックス、およびチェックすることを忘れないでください 一意の値 オプション。 スクリーンショットを参照してください:

3。 クリック Ok 乱数を生成してダイアログを終了します。

注:選択したセルが乱数よりも大きい場合、冗長セルは空白として表示されます。

ランダムな一意の日付、ランダムな一意の時刻を挿入することもできます ランダムデータを挿入。 の無料トライアルをご希望の場合 ランダムデータを挿入, 今すぐダウンロードしてください!
ランダムデータを挿入

ヒント。データをランダムに選択または並べ替える場合は、Kutools forExcelを使用してみてください 範囲をランダムに並べ替える 次のスクリーンショットに示すように。 30日で無制限にフル機能、 今すぐダウンロードして無料トライアルをお試しください。

ドキュメントはランダムに選択します


矢印青い右バブル 重複せずにランダムデータを挿入する




ワークシートのセル範囲に複数のチェックボックスまたはボタンをすばやく挿入する

Excelでは、一度にXNUMXつのチェックボックス/ボタンしかセルに挿入できません。複数のチェックボックス/ボタンを同時に挿入する必要がある場合は面倒です。 Kutools for Excel 強力なユーティリティがあります- バッチ挿入チェック ボックス(BOX) / バッチ挿入オプションボタン ワンクリックで選択したセルにチェックボックス/ボタンを挿入できます。  クリックすると、30 日間の全機能を無料で試用できます。
ドキュメント挿入チェックボックスオプションボタン
 
Kutools for Excel:300を超える便利なExcelアドインがあり、30日以内に制限なしで無料で試すことができます。

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (17)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
En la parte Genere números aleatorios únicos con fórmulas como hago para ampliar el numero de columnas pasar de 2 a 5 sin repetir los numeros segun la formula que ud puso: =IF(ROW()-ROW(A$1)+1>$D$1/2,"",RANK(OFFSET($E$1,ROW()-ROW(A$1)+(COLUMN()-COLUMN($A1))*($D$1/2),),$E$1:INDEX($E$1:$E$1000,$D$1)))
This comment was minimized by the moderator on the site
Hello. I just found this site, and am trying to figure out best way to assign a new code to people. I'd like to assign a random code for people to use between 1000 and 65000, that does not equal any codes already assigned. I'd also like it to be formatted with 5 numbers (00000), but that's not a big deal if it doesn't take care of that. Any ideas on how to make this work? TIA :-)
This comment was minimized by the moderator on the site
Hi, Janel, why you donot try the Data Validation in Excel? It can only allow whole numbers between 1000 and 65000 to be entered in a cell range.
This comment was minimized by the moderator on the site
Help anyone :-) This one I cannot figure out. At our school we often put together students in groups - 2 and 2 together for a number of working sessions. 9 in this case. There are 18 students (vary) in the class. What I am chasing is a formula that gives me a random result of who should work together in the 9 working sessions without having students meeting each other twice. So I need Excel to give me a result of 18 students spread across 9 working sessions and any student must not be match with another student twice. How the xxxx do I fix that? I have search all over the place for inspiration without luck. Any input is appreciated :-)
This comment was minimized by the moderator on the site
Hi, Anders, you need to list all names in column A, then in column B, apply formula =rand(), then specify 2 as the size in cell F2, now apply this formula =ROUNDUP(RANK(B3,$B$3:$B$19)/$F$2,0) in column C as below screenshot shown
This comment was minimized by the moderator on the site
Hi. Thanks for your reply.
I understand you suggestions, but how do I achieve a setup where all students are assigned to maksimum number of workshops where 2 students are randomly assigned to first one workshop, then the second workshop, then the third workshop etc. etc. and to take this even further a student must not be matched with another student that he/she already have worked with. So when having 18 students I need "the system" to allocate all student to (in this case) 9 workshop (e.g. one workshop per week) and no student should be a student they have already worked with.
This comment was minimized by the moderator on the site
Hi there, did you ever manage to work out a solution to this, I've encountered the same issue. Any help would be appreciated.
This comment was minimized by the moderator on the site
Or you could use a sudoku setup.
This comment was minimized by the moderator on the site
How can I do the same thing with a custom list? Not numbers?
This comment was minimized by the moderator on the site
Your custom list is in Column A. Lets say it has 100 values and it is located in A1:A100

Column B is a counter:
1 for B1 and (B1+1) for B2:B100

Column C is a random list:
RAND() for C1:C100

Column D is a random rank based on the random list:
RANK.EQ(C1;$C$1:$C$100)

Column E is your output:
INDEX($A$1:$A$100;MATCH(D1;$B$1:$B$100;0))

Note: There is virtually no chance of generating a duplicate value on column C since RAND() have billions of possibilities. But, if you really want to erase that chance you can type the following formula at column D2:D100
IF(COUNTIFS($C$2:C2;C2)>0;D1+1;RANK.EQ(C2;$C$1:$C$100))
This comment was minimized by the moderator on the site
I need to create 5000 random numbers 1-90 no duplicates 30 columes I and using the formula =RAND() and =IF(ROW()-ROW(A$1)+1>$D$1/2,"",RANK(OFFSET($E$1,ROW()-ROW(A$1)+(COLUMN()-COLUMN($A1))*($D$1/2),),$E$1:INDEX($E$1:$E$1000,$D$1))) is there way that i could change the formula to extract the 5000 numbers
This comment was minimized by the moderator on the site
Sorry I have no idea, you can place this problem to our forum https://www.extendoffice.com/forum.html, maybe someone can help you.
This comment was minimized by the moderator on the site
After about three hours of trying to completely understand the long complicated formula to generate random numbers without duplicates, I figured out a far simpler formula that has the same results. After you randomly generate the numbers in a column using the RAND() function, You can simplify the formula:=IF(ROW()-ROW(A$1)+1>$D$1/2,"",RANK(OFFSET($E$1,ROW()-ROW(A$1)+(COLUMN()-COLUMN($A1))*($D$1/2),),$E$1:INDEX($E$1:$E$1000,$D$1))) in cell a1 to =Rank(E1,$E$1:$E$50). Then if you would like 50 random generated "unique numbers." you simply drag the formula through column a to cell a50. It is a lot simpler. Thank you for answering my question regardless of the huge unneeded formula. If you did not have this website. I don't think I would have been able to solve my problem. #WAR Jiggly
This comment was minimized by the moderator on the site
Actually, if you have two equal values, rank will give the same value to both. Rank formula does return repeated rank values.
This comment was minimized by the moderator on the site
Manuel Ramirez.

The formula RAND() has hundreds of billions of possibilities, but even so you can use a conditional to not repeat the numbers:
A1 = Rank(E1,$E$1:$E$50)
A2 = IF(COUNTIFS($E$1:E1;E1)>1;A1+1;Rank(E2,$E$1:$E$50)
This comment was minimized by the moderator on the site
Hi, Base on Generate unique random numbers with formulas , How can I specify the starting point of a random number? Let's say I want to random "15 to 30".
This comment was minimized by the moderator on the site
Use RANDBETWEEN() to get random numbers lies between two numbers.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations