100 excel VBA simulations

460 943 0
100 excel VBA simulations

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Free ebooks ==> www.Ebook777.com www.Ebook777.com Free ebooks ==> www.Ebook777.com 100 Excel VBA Simulations www.Ebook777.com Dr Gerard M Verschuuren 100 Excel VBA Simulations Using Excel VBA to Model Risk, Investments, Genetics, Growth, Gambling, and Monte Carlo Analysis Free ebooks ==> www.Ebook777.com Copyright © 2016 by Gerard M Verschuuren All rights reserved ISBN-13: 978-1540445179 ISBN-10:1540445178 www.Ebook777.com I TABLE OF CONTENTS I GAMBLING Chapter 1: The Die Is Cast Chapter 2: Casting Six Dice Chapter 3: Roulette Machine Chapter 4: An X-O Game Chapter 5: A Slot Machine Chapter 6: Gamblers’ Ruin Chapter 7: Lottery Numbers Chapter 8: Win or Lose? Chapter 9: A Letter Game Chapter 10: A Three-Way Circuit Chapter 11: Flock Behavior II STATISTICS Chapter 12: Samples Chapter 13: A Normal Distribution Chapter 14: Distribution Simulations Chapter 15: Discrete Distributions Chapter 16: Peaks Chapter 17: Confidence Margins Chapter 18: Sample Size and Confidence Interval Chapter 19: Random Repeats Chapter 20: Flipping a Fair Coin? Chapter 21: Simulation of Sick Cases Chapter 22: Unbiased Sampling Chapter 23: Transforming a LogNormal Distribution Chapter 24: Outlier Detection Chapter 25: Bootstrapping Chapter 26: Bean Machine Simulation Chapter 27: Correlated Distributions Chapter 28: Sorted Random Sampling Chapter 29: Frequencies III MONTE CARLO SIMULATIONS Chapter 30: The Law of Large Numbers Chapter 31: Brownian Motion Chapter 32: Ehrenfest Urn Chapter 33: Random Walk Chapter 34: A Data Table with Memory Chapter 35: Juror Selection in Court Chapter 36: Running Project Costs Chapter 37: Forecasting Profits Chapter 38: Uncertainty in Sales Chapter 39: Exchange Rate Fluctuations IV GENETICS Chapter 40: Shuffling Chromosomes Chapter 41: Sex Determination Chapter 42: Mendelian Laws Chapter 43: The Hardy-Weinberg Law Chapter 44: Genetic Drift Chapter 45: Two Selective Forces Chapter 46: Differential Fitness Chapter 47: Molecular Clock Chapter 48: DNA Sequencing V SCIENCE Chapter 49: Matrix Elimination Chapter 50: Integration with Simulation Chapter 51: Two Monte Carlo Integrations Chapter 52: Monte Carlo Approach of Pi Chapter 53: A Population Pyramid Chapter 54: Predator-Prey Cycle Chapter 55: Taking Medication Chapter 56: The Course of an Epidemic Chapter 57: Boltzmann Equation for Sigmoidal Curves Chapter 58: Interpolation Chapter 59: A Rigid Pendulum Chapter 60: A Piston Sinusoid Chapter 61: The Brusselator Model Chapter 62: A Hawk-Dove Game VI BUSINESS Chapter 63: Prognosis of Sales Chapter 64: Cycle Percentiles Chapter 65: Cost Estimates Chapter 66: A Filtering Table Chapter 67: Profit Changes Chapter 68: Risk Analysis Chapter 69: Scenarios Chapter 70: Market Growth Chapter 71: A Traffic Situation Chapter 72: Quality Control Chapter 73: Waiting Time Simulation Chapter 74: Project Delays VII FINANCE Chapter 75: Buy or Sell Stock Chapter 76: Moving Averages Chapter 77: Automatic Totals and Subtotals Chapter 78: Fluctuations of APR Chapter 79: Net Present Value Chapter 80: Loan with Balance and Principal Chapter 81: S&P500 Performance Chapter 82: Stock Market Chapter 83: Stock Volatility Chapter 84: Return on Investment Chapter 85: Value at Risk Chapter 86: Asian Options VIII MISCELLANEA Chapter 87: Cracking a Password Chapter 88: Encrypting Text Chapter 89: Encrypting a Spreadsheet Chapter 90: Numbering Records Chapter 91: Sizing Bins for Frequencies Chapter 92: Creating Calendars Chapter 93: Populating a Jagged Array Chapter 94: Filtering a Database Chapter 95: Formatting Phone Numbers Chapter 96: Creating Gradients Chapter 97: Aligning Multiple Charts Chapter 98: Temperature Fluctuations Chapter 99: Working with Fiscal Years Chapter 100: Time Calculations IX APPENDIX Data Tables If Statements Value Type Variables Ranges vs Cells FormulaR1C1 Arrays Error Handling X INDEX Free ebooks ==> www.Ebook777.com II INSTRUCTIONS All simulations in this book are supported by files that you can download from the following website: http://www.genesispc.com/download/100VBAsimulations.zip I assume that you are already familiar with many Excel features, including graphs or charts In this book, I will only explain in more detail those features that are very helpful when you what-if-analysis with simulations For more basic features of Excel, I would refer you to some learning tools that you can find on www.mrexcel.com/microsoft-officevisual-learning.html If you want to create simulations exclusively with Excel functions and formulas, without using VBA, I recommend another book: http://genesispc.com/tocsimulations100.htm This book is not about the basics of Visual Basic (VBA) either It only uses VBA to make simulations faster, better, and more user-friendly If you want to learn VBA from the bottom up, I would recommend my interactive CD-ROM: http://genesispc.com/tocvba2013CD.htm Yet, here are a few basic rules for using VBA: • To start a new command line in VBA, use ENTER • Never use ENTER inside a command line (In this book lines may wrap to the next line, but in VBA that is not allowed.) • A colon (:) can separate amd combine several commands on the same line • Use an apostrophe (‘) for a comment after, or at the end of, a command line • To create shortcuts in Excel for a macro (or Sub in VBA), you need the Developers tab (if that tab is missing, go to File Options | Macros | Options | Shift + a character • Files with macros open with the message “Enable Content.” If you find that annoying place such files in a socalled Trusted Location: Files | Options | Trust Center | Trust Center Setting | Trusted Locations www.Ebook777.com EntireColumn 16 epidemic 112 Err 38 error handling 88, 209 evolutionary strategy 124 exchange rate 78 Exit Sub EXP 172 exponential discounting 158 exponential smoothing 152 F filter 132, 188 fiscal year 198 fitness 92 flocking behavior 22 For-Each-loop 34, 178 For-loop FormatConditions 34 FormatCurrency 16 FormatNumber 10 Formula 40 FormulaR1C1 16, 207 FormulArray 24 founder effect 88 FREQUENCY 24, 182 G Galton board 52 game theory 124 Gantt chart 148 GDP growth 140 genetic drift 88 GoalSeek 36 GoTo gradients 192 H Hardy-Weinberg law 86 HasFormula 154 heterozygote 84 HLOOKUP 106, 138 homozygote 84 I IC50 determination 114 IF statements 204 IFERROR 42 iif function INDEX 50 InputBox 12, 124 Application 98 Int 14 INT integration 100, 102 interpolation 116 Inter-Quartile Range 48 IPMT 160 ISERROR 42 ISFORMULA 70 Iteration 192 J jagged array 186, 208 L Len 190 LinkedCell 203 Locals Window 68 logistic equation 114 LOGNORM.INV 46 lognormal distribution 28, 46 Lotka-Volterra model 108 M MATCH 116 matrix elimination 98 Median Absolute Deviation medicine 110 Mendelian laws 84 Mid 190 MINVERSE 98 MMULT 54, 98 Mod MOD molecular clock 94 Monte Carlo simulation moving averages 152 MsgBox mutations 94 48 60 N NA 66, 196 natural selection 90 net present value 158 normal distribution 24, 26 NORMDIST 26 NORMINV 26, 78 NotePad 178 Now 16 NPV 158 numbering 180 O Offset 4, 134 On Error GoTo Option Explicit outliers 48 38 P password pendulum percentile PERCENTILE phone number 174 118 128 128 190 PI function 104 PMT 160 population pyramid PPMT 160 Preserve 78 project delay 148 Protect 134 106 Q quality control QUOTIENT 144 180 R RAND RANDBETWEEN random sampling 56 random walk 62, 66 Range Range Name 10, 182 ranges and cells 206 ReDim 78 REPT 112 Resize 134 return on investment 168 Rnd ROI 168 ROW 38, 164 S S&P500 performance 162 scenarios 138 Select Case 28, 190 SelectionChange 34 self-reference 68 SetSourceData 24 sex determination 82 Sheets.Count 40 sigmoidal equation 114 sinusoid 120 SIR model 112 SKEW 46 slope 114 Solver 114 solving equations 98 Sort 44 SQRT 36 standard deviation 36 standard error 36, 172 StrReverse 176 Student t-distribution 36 subtotals 154 Sum of Squared Residuals T Table 202 temperature 196 TEXT 46 time 200 time format 200 Timer traffic 142 TRANSPOSE 54 TREND 116 U UBound 32, 132 UserForm 194 UserInterfaceOnly 134 V value type variables Value-at-Risk 170 VaR 170 variable global Variant 4, 134 205 114 Variant arrays 68 VLOOKUP 18, 30, 74 W waiting time 146 WeekDay 184 weighting 18, 44 Worksheet.Add 12 Worksheet_Change 116 About the Author Dr Gerard M Verschuuren is a human geneticist who also earned a doctorate in the philosophy of science He studied and worked at universities in Europe and the United States and wrote several biology textbooks in Dutch During this time, he also used and programmed computer software, including Excel, to simulate scientific problems Currently, he is semi-retired and spends most of his time as a writer, speaker, and consultant on the interface of science and computer programming His most recent computer-related books are: From VBA to VSTO (Holy Macro! Books, 2006) Visual Learning Series (MrExcel.com) VBScript (CD) Excel 2013 for Scientists (CD) Excel 2013 for Scientists (book) 100 Excel Simulations (book) Excel 2013 VBA (CD) Excel Video Medley (double DVD) For more info see: http://en.wikipedia.org/wiki/Gerard_Verschuuren For his YouTube videos on Excel and VBA: http://www.genesispc.com/links.htm#videos All his books, CDs, and DVD’s can be found at http://www.genesispc.com All by the same author, Dr Gerard M Verschuuren Part 1: General Techniques Chapter 2: The Fill Handle Chapter 3: Relative vs Absolute Chapter 4: Range Names Chapter 5: Nested Functions Part Exercises Part 2: Data Analysis Chapter 7: Subtotals Chapter 8: Summary Functions Chapter 9: Unique Lists Chapter 10: Data Validation Chapter 11: Conditional Formatting Chapter 12: Filtering Tools Chapter 13: Lookups Chapter 14: Working with Trends Chapter 15: Fixing Numbers Chapter 16: Copying Formulas Chapter 17: Multi-cell Arrays Chapter 18: Single-cell Arrays Chapter 19: Date Manipulation Chapter 20: Time Manipulation Part Exercises Part 3: Plotting Data Chapter 22: A Chart’s Data Source Chapter 23: Combining Chart Types Chapter 24: Graph Locations Chapter 25: Templates and Defaults Chapter 26: Axis Scales Chapter 27: More Axes Chapter 28: Error Bars Chapter 29: More Bars Chapter 30: Line Markers Chapter 31: Interpolation Chapter 32: Graph Formulas Part Exercises Part 4: Regression and Curve Fitting Chapter 34: Nonlinear Regression Chapter 35: Curve Fitting Chapter 36: Sigmoid Curves Chapter 37: Predictability Chapter 38: Correlation Chapter 39: Multiple Regression Chapter 40: Reiterations + Matrixes Chapter 41: Solving Equations Chapter 42: What-If Controls Chapter 43: Syntax of Functions Chapter 44: Worksheet Functions Part Exercises Part 5: Statistical Analysis Chapter 46: Types of Distributions Chapter 47: Simulating Distributions Chapter 48: Sampling Techniques Chapter 49: Test Conditions Chapter 50: Estimating Means Chapter 51: Estimating Proportions Chapter 52: Significant Means Chapter 53: Significant Proportions Chapter 54: Significant Frequencies Chapter 55: Chi-Squared Testing Chapter 56: Analysis of Variance Part Exercises 100 Excel Simulations: very similar to the ones in this book but all done with formulas (no VBA) Part 1: Basic Essentials Object Oriented Recording Macros Branch Statements Interaction Variables (Value Type) Variables (Object Type) Collections Loop Statements Free ebooks ==> www.Ebook777.com Variables as Arguments Pivot Tables and Charts Part 2: Formulas and Arrays Dates and Calendars The Current-Region WorksheetFunction Property Formula Property FormulaR1C1 Custom Functions Array Functions 1D- and 2D-Arrays Customized Arrays Variant Arrays Part 3: Buttons and Forms Importing and Exporting Buttons, Bars, Menus Application Events User Forms Data Entry + Mail Merge Custom Objects (Classes) Class Collections Error Handling Distributing VBA code VBA Monitoring VBA www.Ebook777.com ...Free ebooks ==> www.Ebook777.com 100 Excel VBA Simulations www.Ebook777.com Dr Gerard M Verschuuren 100 Excel VBA Simulations Using Excel VBA to Model Risk, Investments, Genetics, Growth,... without using VBA, I recommend another book: http://genesispc.com/tocsimulations100.htm This book is not about the basics of Visual Basic (VBA) either It only uses VBA to make simulations faster,... features of Excel, I would refer you to some learning tools that you can find on www.mrexcel.com/microsoft-officevisual-learning.html If you want to create simulations exclusively with Excel functions

Ngày đăng: 12/03/2018, 10:19

Mục lục

  • I. Gambling

    • Chapter 1: The Die Is Cast

    • Chapter 2: Casting Six Dice

    • Chapter 4: An X-O Game

    • Chapter 5: A Slot Machine

    • Chapter 8: Win or Lose?

    • Chapter 9: A Letter Game

    • Chapter 10: A Three-Way Circuit

    • Chapter 13: A Normal Distribution

    • Chapter 18: Sample Size and Confidence Interval

    • Chapter 20: Flipping a Fair Coin?

    • Chapter 21: Simulation of Sick Cases

    • Chapter 23: Transforming a LogNormal Distribution

    • Chapter 26: Bean Machine Simulation

    • Chapter 28: Sorted Random Sampling

    • III. Monte Carlo Simulations

      • Chapter 30: The Law of Large Numbers

      • Chapter 34: A Data Table with Memory

      • Chapter 35: Juror Selection in Court

      • Chapter 36: Running Project Costs

      • Chapter 38: Uncertainty in Sales

      • Chapter 39: Exchange Rate Fluctuations

Tài liệu cùng người dùng

Tài liệu liên quan