Blackjack Excel Vba

This video is a supplement to Blackjack Basic Strategy for Infinite Decks and Blackjack House Edge with Infinite Decks, two videos by the Wizard of Odds, Michael Shackleford. The Wizard calculates the complete blackjack basic strategy and house edge, starting from a blank Excel spreadsheet, without using computer programming. The Excel Blackjack simulator program simulates the play of blackjack for up to thousands of blackjack hands. It consists of several Excel sheets, and a macro that runs a series of functions. These guidelines are designed for anyone somewhat familiar with Microsoft Excel.

  • Business32035

    Accounting & FinanceBusiness ApplicationsCalculatorsDatabases ToolseCommerceEducationInventory & Barcoding ..

  • Communication7105

    Chat & Instant MessagingDial Up & Connection ToolsE-MailFax ToolsNewsletter ManagementOther Comms ToolsPager Tools ..

  • Design15689

    3D Modeling & CADAnimationAuthoring ToolsConverters & OptimizersFont & Icon ToolsGalleryIllustration ..

  • Desktop10436

    Art Screen SaversCartoons Screen SaversClocks & AlarmsCursors & FontsIcons & SymbolNature Screen SaversOther ..

  • Development12505

    Active XBasic, VB, VB DotNetC / C++ / C#Compilers & InterpretersComponent & LibrariesDatabases ManagementDebugging ..

  • Games20784

    ActionAdventure & RoleplayArcadeBoardCards, Casino & LotteryKidsOnline Gaming ..

  • Home & Education19922

    Astrology/Biorhythms/MysticAstronomyComputerDictionariesE-books & LiteratureFood & BeverageGeography ..

  • Multimedia30326

    Audio PlayersAudio RecorderAudio RecordersAudio ToolsCD & DVD ToolsEditing ToolsEncoders & Decoders ..

  • Network14170

    BrowsersDownload ManagersFile SharingFirewalls ToolsFtp-ClientMonitoring ToolsNetworking ..

  • Security8262

    Access ControlAdware & Spyware RemovalAnti-SpamAnti-Virus ToolsCovert SurveillanceEncryption ToolsOther ..

  • System Utilities30183

    Automation ToolsBackup & RestoreBenchmarkingClipboard ToolsFile & Disk ManagementFile CompressionLaunchers & Task Managers ..

  • Web Authoring7581

    ASP & PHPE-CommerceE-Mail ServersFlash ToolsFTP ServersHTML ToolsJava & JavaScript ..

SecuriDesign for CorelDRAW 10 1.0 (

This VBAmacro set for CorelDRAW 10 allows you to design various guilloche patterns, borders and other elements frequently used on certificates, Secure Documents, money bills etc. A very comprehensive tools with easy-to-use interface and close integration ..


Released: Mar 6, 2012 Author: Alex Vakulenko Size: 378 K Shareware

Category: Design - 3D Modeling & CAD

GeoPlot 3.5 (

GeoPlot is a free VBAmacro program used in Excel for plotting geochemical data. It has the following functions: X-Y plot, triangular plot, normalized spidergram, discrimination diagram, and the related functions such as calculating formulas and CIPW ..

Released: Jan 14, 2012 Author: GeoPlot Size: 1832 K Freeware

Category: Design - 3D Modeling & CAD

Reset VBA Password 4.13.526 (

Reset VBA Password is the password recovery utility for password protected VBA Modules in MS Office documents (Excel, Word, Access, Power Point, Project). VBA projects are widely used in applications within the MS Office family and in other applications ..

Released: Jun 1, 2013 Author: ProXoft L.L.C. Size: 2254 K Shareware

Category: System Utilities - Misc. Utilities

Bar Code 3 of 9 3.7 (

Want to print barcodes in Access or Excel? We include VBAmacro functions that do all the work for you. If you don't understand bar codes, just run the Bar39 utility program (included in this package) to build barcodes for you. The download version includes ..

Author: Elfring Consulting Inc Size: 1121 K Demo

Category: Business - Inventory & Barcoding

Kingsoft Writer Professional 2012 (

Writer 2012 also includes a VBAmacro function to assist in the performance of specific database functions and in the execution of certain special commands. Furthermore, Writer added a new 2012 interface that is similar to the Microsoft Office 2007 and ..

Released: Nov 9, 2011 Author: Kingsoft Office Size: 66858 K Shareware

Category: Business - Office Suites & Support Tools

Holy Macro! It's Excel VBA Examples 4.0 (

AMAZING collection of 2,500 VBA examples in a question-and-answer format. Every snippet of VBA you will ever need! This CD is packed with 2,500 Excel Workbooks. Every workbook contains a question, such as How do you display the complete file path in the ..

Released: Jun 2, 2012 Author: MrExcel Size: Commercial

Category: System Utilities - Misc. Utilities

BlueZone VBA 1.0 (

Microsoft Visual Basic for Applications (VBA) is a powerful development technology for rapidly customizing Windows applications like BlueZone, and integrating them with existing data and systems. VBA offers a sophisticated set of programming tools based ..

Released: May 25, 2012 Author: Rocket Software, Inc. Size: 59699 K Freeware

Category: Development - Basic, VB, VB DotNet

Simon Says Blackjack 1.3 (

Play blackjack with two computer generated characters or by yourself. Additional (free) play rooms can be downloaded separately. Develop your own playing strategy with our chart builder, assign that chart to a computer player to determine if your strategy ..

Released: Feb 12, 2012 Author: Accidental Software Size: 9236 K Shareware

Category: Games & Entertainment - Cards, Casino & Lottery

Code VBA 5.0 (

Code VBA can be added to the Visual Basic for Applications editor programmers in order to create better Visual Basic code faster. A set of 25 specialized code builders supports the fast creation of most used code. Using the builders reduces the amount ..

Released: Mar 6, 2012 Author: AGORA Software BV Size: 4474 K Shareware

Category: Development - Basic, VB, VB DotNet

Macro Recorder ActiveX Control 1.50 (

Macro Recorder component provides an easy way to enable your VB, VC++, C#,VB.NET, or other COM environment applications to record and playback mouse clicks, keystrokes and bundle them into a file in order to playback later.Macro Recorder consists of one ..

Author: CprinGold Software Size: 2018 K Shareware

Category: Development - Active X

Blackjack Examiner 2004 (

The Blackjack Examiner is a blackjack simulator that can examine your system against thousands of hands of blackjack with specified house rules in only a few short seconds. Find out whether your system is a winner or a loser BEFORE you put your hard earned ..

Author: FieldCraft Size: 1800 K Shareware

Category: Games & Entertainment - Cards, Casino & Lottery Russell hobbs toaster.

VBA Code Compare 0.4 (

VBA Code Compare allows you to compare and merge any Visual Basic code embedded into a VBA project (macros, sheet code, module code etc.). This tool uses direct access for working with VBA modules. Thus, you don't have to export the source code to a file ..

Author: Formula Software, Inc. Size: 959 K Freeware

Category: Development - Other Development

Blackjack by 1.0 (

Blackjack game by casino. The game of casino blackjack, or 21, is by far the most popular table game offered in gambling establishments. It also has excellent background music and ..

Author: Size: 1194 K Freeware

Category: Games & Entertainment - Cards, Casino & Lottery

EVE Online Mining Macro - Simple Miner 1.0 (

Gold Harvest Macro Solutions is proud to announce the trial launch of the Simple Miner automated Mining macro bot for use with the MMORPG EVE Online! Simple Miner is the most efficient macro in your galaxy!It is a next generation automated mining macro ..

Author: Gold Harvest Macro Solutions Size: 328 K Demo

Category: Games & Entertainment - Online Gaming

Jitbit Macro Recorder 5.0 (

“Jitbit Macro Recorder” is a program that does more than it says on the tin. It records and plays keypresses and mouse movement and clicks; and also acts as an automation tool and an EXE compiler. I like this program because I can record macros ..

Released: Jan 1, 2012 Author: JitBit Software Size: 499 K Shareware

Category: System Utilities - Automation Tools

Jitbit Macro Recorder LITE 4.6 (

Jitbit Macro Recorder LITE is a simple keyboard and mouse recorder. It is a low cost automation software to record and play mouse clicks, mouse movements and keyboard strokes. Macro Recorder LITE is very easy to use, quick to configure and is great value ..

Released: Mar 12, 2012 Author: JitBit Software Size: 1669 K Shareware

Category: System Utilities - Automation Tools

VBA Password 8.5.4623 (

VBA Password is a password recovery tool, which comes in very handy if you forgot, lost, or misplaced your password for VBA (Visual Basic) module in Word or Excel document. Such situation may also occur if someone who does not work with you anymore password ..

Author: LastBit Software Size: 524 K Demo

Category: Security & Privacy - Other

! - Macro Scheduler 1.0 (

Macro Scheduler allows you to create macros in order to control your Windows applications, automate software processes and assign tasks to scheduled events, desktop shortcuts or hotkeys. Performing complex tasks with a single mouse click, or scheduling ..

Author: MacroScheduler Size: 3460 K Shareware

Category: Multimedia - Utilities & Plug-Ins

Macro Scheduler 13.1 (

Macro Scheduler is the computer automation tool that has been chosen by home users, small businesses, and Fortune 100 companies alike. Macro Scheduler's intuitive MacroScript language was designed specifically for automating Windows applications.

Released: Apr 10, 2012 Author: MJT Net Ltd Size: 10342 K Shareware

Category: System Utilities - Automation Tools

Macro MD 1.5 (

Macro MD is a powerful, flexible and easy to use automation tool for Microsoft Windows. Macro MD enables you to automate any task on your computer without the need to learn any scripting language. Macro MD offers forms for every command, you just have ..

Released: Jun 6, 2012 Author: MMDESOFT Size: 6717 K Shareware

Category: System Utilities - Automation Tools

IMDb - Blackjack (

Includes an overview, credits, and taglines from The Internet Movie ..

TV Guide Online: Blackjack (

Includes movie review, plot, and ..

Blackjack Cars (

Makers of Avion, a 2CV based kit car. Contains design and specifications, FAQ, gallery, and price ..

Macro International (

Distributor of Sheico Neoprene, neoprene finished goods and importer of various products from the Pacific Rim ..

Macro Sensors Div. - Schaevitz Technologies (

Manufactures standard LVDT, RVDT and related signal conditioning product lines for OEM and low volume ..

Macro Manufacturing Co. (

Machined parts such as housings, shafts, wheels, gear blanks, screws, nuts, bearing housings, special threads. Uses CAD/CAM and CNC machines. Inspection and statistical process ..

Macro. (

Informative site for distribution of products involved with fieldbus technology. A High bandwidth, non-proprietary fiber optic or wired protocol for machine control based upon 100BaseFX and 100BaseTX ..

Blackjack Trader (

E-mini day trading course that teaches the new or experienced day trader, trading the Standard and Poor's 500 e-mini futures ..

MACRO Consulting, Inc. (

Traditional and online quantitative product research ..

Design, Fabrication and Properties of Macro-Scale Supramolecular Fibers (

Short technical paper describing the design and fabrication of macro-scale supramolecular fibers composed of hydrogen bonded pseudo-polymer chains of guanosine derivatives, including an investigation of the properties of the fibers. Authors: Koji Araki ..

Free Excel Vba Code Samples

Blackjack Vba Macro Free Downloads - 2000 Shareware periodically updates software information and pricing of Blackjack Vba Macro from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using Blackjack Vba Macro crack, password, registration codes, key generators, serial numbers is illegal.

By Cleve Moler, MathWorks

Blackjack is the most popular casino game in the world. Using a basic strategy, a knowledgeable player can reduce the casino's advantage to less than one-half of one percent. Simulating blackjack play with this strategy in MATLAB® is both an instructive programming exercise and a useful parallel computing benchmark.

Blackjack is also known as '21.' The object is to get a hand with a value close to, but not more than, 21. Face cards are worth 10 points, aces are worth either 1 or 11, and all other cards are worth their numerical value. You play against the dealer. You each start with two cards. Your cards are dealt face up; one of the dealer's cards stays face down.

You signal 'hit' to receive additional cards. When you are satisfied with your hand, you 'stand.' The dealer then reveals the hidden card and finishes the hand. If your total ever exceeds 21, you are 'bust,' and the dealer wins the hand without drawing any more cards.

The dealer has no choices to make, and must draw on hands worth less than 17 and stand on hands worth 17 or more. (A variant has the dealer draw to a 'soft' 17, which is a hand with an ace counting 11.) If neither player goes bust, then the hand closest to 21 wins. Equal totals are a 'push,' and neither wins.

The fact that you can bust before the dealer takes any cards is a disadvantage that would be overwhelming were it not for three additional features of the game. On your first two cards:

  • An ace and a face card or a 10 is a 'blackjack,' which pays 1.5 times the bet if the dealer does not also have 21
  • You can 'split' a pair into two separate hands by doubling the bet
  • You can 'double down' a good hand by doubling the bet and receiving just one more card

Basic strategy was first described in the 1956 paper 'The Optimum Strategy in Blackjack,' published in the Journal of the American Statistical Association by four authors from the Aberdeen Proving Ground. It is now presented, with a few variations, on dozens of web pages, including Wikipedia. The strategy assumes that you do not retain information from earlier hands. Your play depends only on your current hand and the dealer's up card. With basic strategy, the house advantage is only about one half of one percent of the original bet.

My MATLAB programs, shown in the sidebar, use three functions to implement basic strategy. The function hard uses the array HARD to guide the play of most hands. The row index into HARD is the current total score, and the column index is the value of the dealer's up card. The return value is 0, 1, or 2, indicating 'stand,' 'hit,' or 'double down.' The other two functions, soft and pair, play similar roles for hands containing an ace worth 11 and hands containing a pair.

The most important consideration in basic strategy is to avoid going bust when the dealer has a chance of going bust. In our functions, the subarray HARD(12:16,2:6) is nearly all zero. This represents the situation where both you and the dealer have bad hands—your total and the dealer's expected total are each less than 17. You are tempted to hit, but you might bust, so you stand. The dealer will have to hit, and might bust. This is your best defense against the house advantage. With naïve play, which ignores the dealer's up card, you would almost certainly hit a 12 or 13. But if the dealer is also showing a low card, stand on your low total and wait to see if the dealer goes over 21.

Excel Vba Form Example

Card counting was introduced in 1962 in Beat the Dealer, a hugely popular book by Edward Thorp. If the deck is not reshuffled after every hand, you can keep track of, for example, the number of aces, face cards, and nonface cards that you have seen. As you approach the end of the deck, you may know that it is “ten rich”—the number of aces and face cards remaining is higher than would be expected in a freshly shuffled deck. This situation is to your advantage because you have a better than usual chance of getting a blackjack and the dealer has a better than usual chance of going bust. So you increase your bet and adjust your strategy.

Card counting gives you a mathematical advantage over the casino. Exactly how much of an advantage depends upon how much you are able to remember about the cards you have seen. Thorp's book was followed by a number of other books that simplified and popularized various systems. My personal interest in blackjack began with a 1973 book by John Archer. But I can attest that card counting is boring, error-prone, and not very lucrative. It is nowhere near as glamorous—or as dangerous—as the recent Hollywood film '21' portrays it. And many venues now have machines that continuously shuffle the cards after each hand, making card counting impossible.

My original MATLAB program, written several years ago, had a persistent array that is initialized with a random permutation of several copies of the vector 1:52. These integers represent both the values and the suits in a 52-card deck. The suit is irrelevant in the play, but is nice to have in the display. Cards are dealt from the end of the deck, and the deck is reshuffled when there are just a few cards left.

This function faithfully simulates a blackjack game with four decks dealt without reshuffling between hands. It would be possible to count cards, but this shuffler has two defects: It does not simulate a modern shuffling machine, and the persistent array prevents some kinds of parallelization.

My most recent simulated shuffler is much simpler. It creates an idealized mechanical shuffler that has an infinite number of perfectly mixed decks. It is not possible to count cards with this shuffler.

I have two blackjack programs, both available on MATLAB Central. One program offers an interface that lets you play one hand at a time. Basic strategy is highlighted, but you can make other choices. For example, Figures 1 and 2 show the play of an infrequent but lucrative hand. You bet $10 and are dealt a pair of 8s. The dealer's up card is a 4. Basic strategy recommends splitting the pair of 8s. This increases the bet to $20. The first hand is then dealt a 3 to add to the 8, giving 11. Basic strategy recommends always doubling down on 11. This increases the total bet to $30. The next card is a king, giving the first hand 21. The second hand is dealt a 5 to go with the 8, giving it 13. You might be tempted to hit the 13, but the dealer is showing a 4, so you stand. The dealer reveals a 10, and has to hit the 14. The final card is a jack, busting the dealer and giving you $30. This kind of hand is rare, but gratifying to play correctly.

Figure 1. Start of an atypical but important example: You are dealt a pair of 8s, and the dealer's up card is a 4. Basic strategy, highlighted in red, recommends splitting the pair.'>

Figure 1. Start of an atypical but important example: You are dealt a pair of 8s, and the dealer's up card is a 4. Basic strategy, highlighted in red, recommends splitting the pair.

Figure 2. The final outcome. After splitting, you double down on your first hand and stand on your second. The dealer goes bust, giving you a rare 3x win.'>

Figure 2. The final outcome. After splitting, you double down on your first hand and stand on your second. The dealer goes bust, giving you a rare 3x win.

My second program plays a large number of hands using basic strategy and collects statistics about the outcome.

Accelerating the Simulations with Parallel Computing

I like to demonstrate parallel computing with MATLAB by running several copies of my blackjack simulator simultaneously using Parallel Computing Toolbox. Here is the main program:

The matlabpool command starts up many workers (copies of MATLAB) on the cores or processors available in a multicore machine or a cluster. These workers are also known as labs. The random number generators on each lab are initialized to produce statistically independent streams drawn from a single overall global stream. The main program on the master MATLAB creates an array B, and then the parfor loop runs a separate instance of the sequential simulator, blackjacksim, on each lab. The results are communicated to the master and stored in the columns of B. The master can then use B to produce the plot shown in Figure 3. With 'only' 25,000 hands for each player, the simulation is still too short to show the long-term trend. The computation time is about 11 seconds on my dual-core laptop. If I do not turn on the MATLAB pool, the computation uses only one core and takes almost 20 seconds.

Figure 3. Four players in a parallel simulation. Green wins, red nearly breaks even, cyan muddles through, and blue should have quit while he was ahead.'>

Figure 3. Four players in a parallel simulation. Green wins, red nearly breaks even, cyan muddles through, and blue should have quit while he was ahead.

This run can also produce the histograms shown in Figure 4. The cumulative return from the four players is the dot product of the two vectors annotating the horizontal axis. The discrepancy between the frequency of $10 wins and $10 losses is almost completely offset by the higher frequencies of the larger wins over the larger losses. The average return and a measure of its variation are shown in the title of the figure. We see that in runs of this length, the randomness of the shuffle still dominates. It would require longer runs with millions of hands to be sure that the expected return is slightly negative.

Figure 4. Histograms for each player. The $10 bet is a push 9% of the time, a $10 win 32%, and a $10 loss 42%. Blackjacks yield $15 wins 4.5% of the time. The less frequent $20, $30, and $40 swings come from doubling down, splitting pairs, and doubling after splitting.'>

Figure 4. Histograms for each player. The $10 bet is a push 9% of the time, a $10 win 32%, and a $10 loss 42%. Blackjacks yield $15 wins 4.5% of the time. The less frequent $20, $30, and $40 swings come from doubling down, splitting pairs, and doubling after splitting.

Blackjack can be a surrogate for more sophisticated financial instruments. The first graph in Figure 5 shows the performance of the Standard & Poor's stock market index during 2011. The second shows the performance of our blackjack simulation playing 100 hands a day for each of the 252 days the stock market was open that year. The S&P dropped 14.27 points. Our blackjack simulation, which bet $10 per hand, lost $3860 over the same period. More important than these final results is the fact that both instruments show large fluctuations about their mean behavior. Over the short term, stock market daily behavior and card shuffling luck are more influential than any long-term trend.

Figure 5. The Standard & Poor's stock market index over one year versus 100 hands of blackjack per day for the same time. Short-term random fluctuations dominate any long-term trend.'>

Figure 5. The Standard & Poor's stock market index over one year versus 100 hands of blackjack per day for the same time. Short-term random fluctuations dominate any long-term trend.

Published 2012 - 92052v00


  • Baldwin, R. R., Cantey, W. E., Maisel, H., and McDermot, J. P. “The Optimum Strategy in Blackjack,” Journal of the American Statistical Association, 51:429-439 (Sept.), 1956.
  • Thorp, E. O. Beat the Dealer. New York: Random House, 1962.
  • Wikipedia.

Products Used

Learn More

View Articles for Related Capabilities