Poker table...

grey_baker

New Member
Joined
Jan 5, 2010
Messages
2
Hi all,

I am trying to stretch my excel abilities by building a poker table on excel. So far, so good, but i'm having difficuly stopping the cards which currently appear randomly from being duplicates.. i.e in a hand having to queen of hearts!

Any ideas?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
You could have several arrays?

A Deck array
and then several player arrays.

Each array would have 52 items (1 for each card) and by default have a Value of 0

Deck(0,1) = "Ace of Spades"
Deck(0,2) = 0

0 could = available
1 could = dealt

Just an idea but worth a shot..
 
Upvote 0
One approach:
Rather than using random numbers to select a card to be dealt, generate 52 random numbers using Rand then reorder (shuffle) the cards based on the random numbers. You then need only to deal the cards "off the top"
 
Upvote 0
One approach:
Rather than using random numbers to select a card to be dealt, generate 52 random numbers using Rand then reorder (shuffle) the cards based on the random numbers. You then need only to deal the cards "off the top"

Sounds excellent... whats the formula to do this?
 
Upvote 0
For example if your deck is in A2:A53, in B2 use the formula =RAND(). Drag this formula down through B53. Copy these cells and Edit-Paste Special-Values (Excel 2003). Select A2:B53 and sort on column B. Then to deal the cards use =INDEX(A2:A53,1) to deal the first card and =INDEX(A2:A53,2) to deal the second card etc.
 
Upvote 0
This can be done on a worksheet

In A2:A53 put the formula =ROW(a1) dragged down (to give the sequence 1,2,3...,52)

In B1 the formula =INDEX(A:A,RANDBETWEEN(1,52-COLUMN(A1)),1)
In B2 the formula =IF(A2<B$1,A2,A3), drag that down to B52

Drag B1:B52 to the right for 52 columns.

B1:AZ1 will hold your shuffle.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top