+ Reply to Thread
Results 1 to 5 of 5

A simple magic card trick in Excel

  1. #1
    Registered User
    Join Date
    12-13-2022
    Location
    Hardeeville, SC
    MS-Off Ver
    365
    Posts
    8

    A simple magic card trick in Excel

    VBA Magic Card Trick VBA Card Trick.xlsm

    As a kid, I learned this magic card trick using a physical deck of cards. It is your typical "pick a card, any card" trick. There is no slight-of-hand, but there are a couple of tricks that make it work. This article will show you the trick, how it is performed, and how it was implemented in Excel.

    The Trick
    The trick is performed using 21 random cards dealt face up in 3 columns of 7 cards each. Like this:
    7C JS 2D
    5S 2S 7S
    KS QC 4H
    3D 5D JD
    4S 8S 6S
    8D 9S 3H
    7D 2H 10D

    Ask your volunteer to "pick a card, any card but don't tell me what it is." Once they select a card, ask them what column contains that card. They answer "left", "middle" or "right". Or they could answer "first", "second" or "third". Or even just point to the column.

    You pick up the cards, deal them out again, and ask for the column that contains that same card. The volunteer let?s you know the column. You pick up the card and deal them out again. Ask your volunteer a third time what column the card is in.

    Once they select the column, you now know the exact card they chose, and you perform your reveal. The reveal can be just telling them their card, or picking up the cards and discarding them until only their card remains, or many other flashy techniques to tell them their chosen card. They are amazed.

    The Secret
    Your volunteer probably assumes you memorized all the cards and where they are located. But that is definitely not the case. The secret is how you deal the cards and how they are picked up.

    Dealing
    The cards always remain face up. Do not turn them over. Always deal the cards across, left to right. Then to the next row down. Like this:
    1 2 3
    4 5 6
    7 8 9
    10 11 12
    13 14 15
    16 17 18
    19 20 21

    Pick up
    Whatever column your volunteer says their card is located in, that column must be picked up 2nd. For example, if the card is in the right column, pickup left column first, then the right column and finally the center column. It does not matter which column is picked up first or last, only the column with the card must be picked up 2nd.

    Also, the column should be picked up so the top of the column ends up at the bottom of that stack. What does that mean? If the volunteer says their card is in the center column. Slide the cards in the left column down towards you so 19 ends up on top and 1 ends up on the bottom. Place that stack on the 20 card and slide them towards you so the 2 card ends up at the bottom of the combined stack. Place that stack on the 21 card and slide them down so the 3 card ends up on the bottom the entire stack. The top card will be the 19, the bottom card will be the 3.

    The Answer
    1) You deal once. The card is selected. The column is pointed out
    2) You pick up the cards
    3) You deal again.
    4) The column is pointed out
    5) You pick up the cards
    6) You deal again.
    7) The column is pointed out.

    The card that was selected always ends up as the 4th card down. Once the column is pointed out that third time, you know the exact card they chose. Let?s say after step 6 the cards look like this

    2S AD 9D
    4C 4S AS
    5D 3C KC
    10S 6H 5H
    QD 7S 7C
    2C 10D JD
    AC 9S 4H

    You know their card is either 10S, 6H or 5H. When they tell you the column in step 7, you know the exact card they selected.

    Excel
    There are 4 buttons placed on the worksheet. The first is a Shuffle button that mixes up the cards. It really is not necessary but it adds a little more randomness to the trick.

    The other 3 buttons allow the selection of the column the card is in. The code for each button just identifies the column and passes that info to the pickup and deal routine. Here is the example of the ?2 Button.?

    Please Login or Register  to view this content.
    The pickup and deal routine sets up which column is picked up first, second and third

    Please Login or Register  to view this content.
    There is an array to hold the card while picking them up and dealing them out. Whatever column is picked up first goes in the array as cards(0) to cards(6). The second column, the one with the volunteer?s card, goes in cards(7) to cards(13). And the final column goes in cards(14) to cards(20).

    The cards are dealt in the order described above. Across from left to right, then down the next row.

    After the third deal and the column is selected, the winning card will always be in cards(10).

    There is also 2 conditional formats for the playing area and the column with all cards. Both format check for D or H and color the font red.
    Last edited by tj4242; 12-16-2022 at 11:39 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    11-27-2011
    Location
    usa
    MS-Off Ver
    Excel 2007, Excel 365
    Posts
    495

    Re: A simple magic card trick in Excel

    Just saw this today and it seems to be a knockoff version of the original card 'Trick'.

    The 'original' card 'trick' uses 27 cards as opposed to the version in post #1 which only uses 21 cards.

    The way the 'trick' works is simply by mathematics.
    1) You start out by asking a volunteer to look through the 27 different cards and ask them to remember what one of the 27 cards are.
    2) You then ask the volunteer to watch what pile their 'chosen' card lands in.

    Round 1:
    3) The cards are then dealt one at a time face up into 3 piles from left to right until all 27 cards have been gone through.
    4) You then ask the volunteer to select the pile that contains their 'chosen' card.
    5) You then stack the other 2 piles of cards onto the pile that the volunteer pointed out.

    Round 2:
    6) Flip the stack of cards over and ask the volunteer to watch for which pile of cards their 'chosen' card lands in this time.
    7) Repeat steps 3 through 5

    Round 3:
    8) Repeat steps 6 & 7
    9) Flip the stack of cards over and the 'chosen' card will be the top card.


    Here is where the mathematics are involved:
    You are starting with 27 cards, after the first round, a pile of cards is chosen which contains only 9 cards ... 27 cards / 3 piles.
    After the second round, the 'chosen' card, one of the 9 cards from the first round, is within one of the 3 piles ... this makes the math involved 9 cards / 3 piles which means the 'chosen' card will be one of 3 cards.
    The third round will put the 'chosen' card as either the first card dealt, second card dealt, or the third card dealt, after the rest of the 27 cards are dealt out, the pile chosen reveals whether the 'chosen' card was the first, second, or third card that was dealt ... 3 cards / 3 piles = 1


    I am attaching the modified version of the file from post #1 that will do the 'trick' with the 27 cards.
    Attached Files Attached Files
    Last edited by johnnyL; 10-30-2023 at 07:44 PM.

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: A simple magic card trick in Excel

    The instructions are not exactly clear. Following the steps I find the program is delivering a selection after the second round and the card displayed is wrong.

    Would you be so kind to review the instructions ... verify the various steps are correct ... then perhaps re-write the directions so they are clearer ? Here is just one step that
    is in confusion ... how do you "deal" the cards at each step ?

  4. #4
    Valued Forum Contributor
    Join Date
    11-27-2011
    Location
    usa
    MS-Off Ver
    Excel 2007, Excel 365
    Posts
    495

    Re: A simple magic card trick in Excel

    Hey there @Logit!

    If you are referring to the script I posted, the directions are:
    1) Click the 'Shuffle' buton.
    2) From the 'cards' shown in D2:H10, 'Choose' one of them that you want for your 'secret card' and remember it, write it down, whatever.

    Round 1:
    3) Click the button 1, 2, or 3 that indicates which column the card that you 'chose' is in.

    Round 2:
    4) After step 3, the 'cards' in D2:H10 will be rearranged, Now select the button 1, 2, or 3 that indicates which column your 'chosen' card is now located in.


    Round 3:
    5) After step 4, the 'cards' in D2:H10 will be rearranged, Now select the button 1, 2, or 3 that indicates which column your 'chosen' card is now located in.


    The 'card' that you 'chose' will now be located in F21


    If that was not what you were asking for, please let me know.

  5. #5
    Registered User
    Join Date
    12-13-2022
    Location
    Hardeeville, SC
    MS-Off Ver
    365
    Posts
    8

    Re: A simple magic card trick in Excel

    Thanks johnnyL. I never saw the 27 card version of the trick before.

    I have combined the 2 versions into a single workbook with each version on a worksheet.

    Enjoy the "magic"
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. (Excel magic trick ¤241) Data Validation w Shrinking List
    By Krypton in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-02-2016, 01:23 PM
  2. [SOLVED] My date/Time conundrum or am I missing a simple trick?
    By Missus Mommabear in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-28-2015, 07:38 AM
  3. COUNTIFS AND OR or some other magic trick that will solve this issue...
    By lumberjim in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-15-2013, 02:28 AM
  4. [SOLVED] Excel Magic Trick 369 with blank cells
    By hejsanb in forum Excel General
    Replies: 14
    Last Post: 07-01-2012, 07:23 AM
  5. create new simple stock card / control
    By SelinaT in forum Excel General
    Replies: 0
    Last Post: 09-22-2010, 11:34 PM
  6. SImple Time Card
    By djwryn in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-02-2010, 03:08 PM
  7. Macro magic trick
    By new2XL in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2007, 02:21 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1