Page 1 of 1

คำสั่ง Random ของ Excel ถ้าจะสุ่มตัวเลข 1-5 จำนวน 500 ช่อง โดยสั่งให้ออก 1 จำนวน 25, ออก 2 ..(วนไป) ต้องใส่ fn ยังไงครับ

Posted: Sat Apr 22, 2017 5:07 pm
by Artified
ไม่รู้จำได้ไหม เช่น จะให้สุ่มตัวเลข 1-5 ในจำนวน 500 ช่อง โดยกำหนดให้ออก 1 จำนวน 25 cells, ออก 2 จำนวน 50 cells .. วนไปเรื่อยๆ จนครับเลข 5 :flw:

โดยทั้งนี้ ประมวลผลภายใน 500 cells ที่เลือกครับ

เราต้องใส่ค่า fn ยังไงเหรอครับผม เพราะเข้าใจว่าสูตรปกติ มันสุ่มแบบกระจายไร้ทิศทางกำหนดครับ

Image

Re: คำสั่ง Random ของ Excel ถ้าจะสุ่มตัวเลข 1-5 จำนวน 500 ช่อง โดยสั่งให้ออก 1 จำนวน 25, ออก 2 ..(วนไป) ต้องใส่ fn ยังไง

Posted: Sat Apr 22, 2017 6:37 pm
by snasui
:D แนบไฟล์ Excel มาด้วยเพื่อสะดวกในการตอบปัญหาของเพื่อนสมาชิกครับ

Re: คำสั่ง Random ของ Excel ถ้าจะสุ่มตัวเลข 1-5 จำนวน 500 ช่อง โดยสั่งให้ออก 1 จำนวน 25, ออก 2 ..(วนไป) ต้องใส่ fn ยังไง

Posted: Sat Apr 22, 2017 7:04 pm
by Artified
Book1.xlsx
Just the first post Krub. Enclosed file per attachment, thanks in advance for your support. :)

Re: คำสั่ง Random ของ Excel ถ้าจะสุ่มตัวเลข 1-5 จำนวน 500 ช่อง โดยสั่งให้ออก 1 จำนวน 25, ออก 2 ..(วนไป) ต้องใส่ fn ยังไง

Posted: Sat Apr 22, 2017 7:05 pm
by snasui
:D แก้ไขการโพสต์ให้เป็นไปตามกฎการใช้บอร์ดข้อ 1 ด้านบนเสียก่อนครับ :roll:

Re: คำสั่ง Random ของ Excel ถ้าจะสุ่มตัวเลข 1-5 จำนวน 500 ช่อง โดยสั่งให้ออก 1 จำนวน 25, ออก 2 ..(วนไป) ต้องใส่ fn ยังไง

Posted: Sat Apr 22, 2017 7:56 pm
by snasui
:D Try this,

In Sheet3
  1. A1:D1 enter No, Rand, Rank and Random respectively.
  2. A2:A25 fill with 1, A26:A75 fill with 2 etc.
  3. B2 enter this formula.
    =RAND()
    Press Enter and copy down.
  4. C2 enter this formula.
    =RANK(B2,$B$2:$B$75)
    Press Enter and copy down.
  5. D2 enter this formula.
    =INDEX($A$2:$A$75,MATCH(ROWS(D$2:D2),$C$2:$C$75,0))
    Press Enter and copy down.
The above procedure for 2 numbers. You can add other number on column A and adjust formula for your suit and you can press F9 for random and keep data to destination cells.

Re: คำสั่ง Random ของ Excel ถ้าจะสุ่มตัวเลข 1-5 จำนวน 500 ช่อง โดยสั่งให้ออก 1 จำนวน 25, ออก 2 ..(วนไป) ต้องใส่ fn ยังไง

Posted: Sat Apr 22, 2017 8:32 pm
by Artified
Thanks for your reply. But it's seem to confuse to me for the formula. I attached my edit file with this comment and its result may show error Krub. If you able to specific my mistake in any formula, please recommend Krub. :thup:
00.PNG
Book2.xlsx

Re: คำสั่ง Random ของ Excel ถ้าจะสุ่มตัวเลข 1-5 จำนวน 500 ช่อง โดยสั่งให้ออก 1 จำนวน 25, ออก 2 ..(วนไป) ต้องใส่ fn ยังไง

Posted: Sat Apr 22, 2017 8:42 pm
by snasui
:D Please carefully read and follow my post above. All data is on Sheet3 not on original sheet. The result is on column D and you can press F9 for random and copy the result to destination cells.

Re: คำสั่ง Random ของ Excel ถ้าจะสุ่มตัวเลข 1-5 จำนวน 500 ช่อง โดยสั่งให้ออก 1 จำนวน 25, ออก 2 ..(วนไป) ต้องใส่ fn ยังไง

Posted: Sat Apr 22, 2017 11:32 pm
by Artified
Thanks Khun Snasui Krub. I also attached the example file which may useful with the others per enclosed. :cp:
Book3.xlsx