SPREADSHEET SIMULATION IN ACCOUNTING WITHOUT ADD-INS V. Reddy Dondeti, Ph.D. Professor Norfolk State University 700 Park Avenue Norfolk, VA 23504 E-mail: rdondeti@nsu.edu Johnnie A. Mapp, Ph.D. Professor Norfolk State University 700 Park Avenue Norfolk, VA 23504 E-mail: jmapp@nsu.edu Jim Chen*, Ph.D. Professor Norfolk State University 700 Park Avenue Norfolk, VA 23504 E-mail: jchen@nsu.edu *Corresponding Author SPREADSHEET SIMULATION IN ACCOUNTING WITHOUT ADD-INS ABSTRACT Simulation is widely used in both accounting practice and auditing practice for a variety of types of problems. It is also utilized extensively in accounting education. Addressing the functional competencies in the AICPA Core Competency Framework for Entry into the Accounting Profession, AICPA states that individuals entering the accounting profession must be able to build appropriate models and simulations using electronic spreadsheets and other software. Developing and experimenting a simulation model on an electronic spreadsheet not only eliminates the need for learning a programming language and simplifies the model building process but also eases the experiments for different values of the parameters. This paper is organized as follows. At first, it provides a discussion of random number generators in the electronic spreadsheet environment. Next, it demonstrates the use of Microsoft Excel to develop two working simulation models without third-party add-ins. INTRODUCTION Simulation is widely used in accounting practice to analyze risk. It is employed in managerial accounting practice for (1) financial forecasting and budgeting, (2) replacement and maintenance of machinery/equipment, (3) analyzing capital investment, (4) make or buy decisions, (5) planning and controlling the budgetary process, (6) planning and implementing revisions in accounting systems, (7) inventory analysis and control, (8) production planning and control, and (9) strategic enterprise management (O’Leary, 1983; Kramer et al, 2008). It is also heavily used in auditing practice. For example, parallel simulation is used frequently for controls testing and substantive testing (Turney and Watne, 2003). Simulation is widely utilized in accounting education as well to introduce uncertainty modeling, risk analysis, financial fraud detection, unique accounting needs of smaller businesses, and strategic enterprise management to students, and to develop students’ critical thinking skills (Blankley et al, 2004; Jabbour and Liu, 2005; Rich and Cascini, 2006; Cascini and Rich, 2007; Ragan et al, 2008; Schiff and Smith, 2008; Togo, 2007 & 2008). Addressing the functional competencies in the AICPA Core Competency Framework for Entry into the Accounting Profession, AICPA states that individuals entering the accounting profession must be able to build appropriate models and simulations using electronic spreadsheets and other software (AICPA, 2009). Though user-friendly simulation software packages (e.g. Arena, ProcessModel and ProModel) are available, developing a simulation model on an electronic spreadsheet has several advantages: (1) the elimination of the need for learning a programming language, (2) the wide spread availability of and familiarity with spreadsheet software, (3) the availability of many built-in statistical functions for generating random numbers and data summarization, (4) the capability of displaying information in detail and in easy-to-read format, not just the final results, (5) the ease of experiments for different values of the parameters, (6) the capability of developing simulation models without add-ins such as Crystal Ball and @RISK, and (7) a better understanding of the basic concepts behind the simulation models. This paper is organized as follows. At first, it provides a discussion of random number generators in the electronic spreadsheet environment. Next, it demonstrates the use of Microsoft Excel to develop two working simulation models without third-party add-ins. RANDOM NUMBER GENERATORS One of the requirements of almost any simulation model is some facility for generating random numbers. Microsoft Excel provides two uniform random number generators in the form of functions: RAND() and RANDBETWEEN(a,b). However, other theoretical distributions – such as normal, exponential, gamma, and Poisson distributions – are encountered more frequently than is the uniform distribution. In many cases, an empirical distribution is used. The inverse transformation method is a general method for transforming a standard uniform deviate into any other distribution, especially, when the distribution is an empirical one. In this section, we briefly discuss procedures for generating random numbers from empirical and frequently used theoretical distributions based on the inverse transformation method. Our emphasis is on procedures that can be coded in a single statement. The procedures for generating random numbers are well discussed in many simulation books. We refer the interested readers to Random Number Generation and Monte Carlo Methods by James Gentle (Gentle, 2004). Empirical Distribution Using the inverse transformation method for a general discrete distribution is essentially a table lookup. To generate random numbers from an empirical distribution, we can use either the LOOKUP, VLOOKUP, or HLOOKUP functions provided by Excel. The vector form of LOOKUP function is discussed here. The syntax of the vector form is =LOOKUP(lookup_value, lookup_vector, result_vector) The values in the lookup vector must be in ascending order. LOOKUP compares the lookup_value to each cell in the lookup_vector until it finds a cell larger than the lookup_value. It then moves up one cell and returns the content of the corresponding cell in the result_vector as the answer. For example, assume the relative frequency of sales in unit per month for laser printers is as shown in Table 1. Table 1 Unit Sales of Laser Printers Unit Sales Per Month Relative Frequency 350 0.1 450 0.1 550 0.5 650 0.3 To generate monthly unit sales, say, for six months in cells E2 through E7 from the above empirical distribution, at first, convert Table 1 into a cumulative-relative-frequency table as shown in Columns A and B of Table 2. Then, type =LOOKUP(RAND(),$B$2:$B$5, $A$2:$A$5) in cell E2. Finally, position the mouse pointer over the fill handle and drag it to cell E7 to extend the LOOKUP function from cell E2 to the range E3:E7. Suppose the numbers generated by RAND() are 0.22, 0.04, 0.39, 0.78, 0.23, and 0.16, the unit sales generated will be 550, 350, 550, 650, 550, and 450, respectively. Table 2 Illustration of Empirical Random Number Generation Triangular Distribution The cumulative distribution function (CDF) of a triangular distribution with lower limit a, mode c and upper limit b is The inverse of F is then Thus, a triangular-distributed random number can be generated by the Excel formula =IF(r<=(c-a)/(b-a), a+SQRT(r*(b-a)*(c-a)),b-SQRT((1-r)*(b-a)*(b-c)) where r can be generated by the RAND() function. Storing the value from the RAND() function in the variable r is important because the RAND() function returns a new value each time it is called. The Triangular Distribution may be used when the knowledge about a population is limited but the minimum, maximum and mode are known. Exponential Distribution The CDF of an exponentially distributed random variable is F(x) = 1 – e-βx for x > 0 where 1/β equals the mean of the exponential random variable. The inverse of F is then F-1(r) = -ln(1-r)/β Therefore, the Excel formula for generating an exponentially distributed random number is simply = -LN(1-RAND())/beta Because RAND() is uniformly distributed, 1-RAND() is also uniformly distributed, and the above Excel formula can be further simplified as = -LN(RAND())/beta The distribution of time that elapses before the occurrence of some event often follows an exponential distribution. Normal Distribution The closed-form functional representation of the inverse of the CDF for the normal distribution does not exist. Fortunately, Excel has a built-in function NORMINV(probability,mean,std_dev) which returns the inverse of the normal cumulative distribution for the specified mean and standard deviation. So, to generate a normal random number in Excel, we can use the simple formula = NORMINV(RAND(), mean, std_dev) Gamma Distribution There are two ways of writing (parameterizing) the gamma distribution that are common in the literature. EXCEL uses Excel provides a built-in function GAMMAINV(probability,alpha,beta) which returns the inverse of the gamma cumulative distribution. Thus, we can use the following formula to generate a gamma distributed random number in Excel. =GAMMAINV(RAND(),alpha,beta) Because an exponential distribution with parameter beta is the same as a gamma distribution with parameters alpha and beta where alpha = 1, the GAMMAINV function can also be used to generate an exponentially distributed random variable. The distribution of time that elapses before the alphath occurrence of some event often follows a gamma distribution. Gamma distribution also provides the most common best fit to lead-time demand for a variety of inventory items (Bagchi et al, 1986). Binomial Distribution To generate a binomially distributed random number with parameters n and p, we can generate n standard uniform numbers and the number of these standard random numbers that are less than or equal to p is the binomially distributed random number generated. This procedure is useful when the value of n is not large. So, for small values of n, we can use the following formula to generate a binomially distributed random number in Excel. =IF(RAND()<=p,1,0)+IF(RAND()<=p,1,0)+IF(RAND()<=p,1,0)+. . . + IF(RAND()<=p,1,0) where IF(RAND()<=p,1,0) appears n times. For large values of n, the normal approximation to binomial may be used. Poisson Distribution The Poisson random number generator cannot be coded in a single expression. However, we may use the POISSON function to construct a cumulative distribution table. Then the LOOKUP function can be used to access the table to generate the Poisson random numbers in our spreadsheet simulation model. The syntax of the POISSON function is = POISSON(x,mean,cumulative) where x = the number of events, mean = the expected value, and cumulative = a logical value that determines the probability returned. If cumulative is TRUE, POISSON returns the cumulative probability that 0 ≤ X ≤ x; if FALSE, it returns the probability that X = x. For example, to develop a cumulative distribution table for a Poisson random variable with mean = 3 in columns A and B, we (1) enter the number of events in column A as shown in Table 3, (2) enter 0 and =POISSON(A2,3,TRUE) to cells B2 and B3, respectively, and (3) extend the POISSON function in cell B3 to the range B4:B14. The POISSON functions in column B are in a cell higher than their corresponding number of events because of the way the LOOKUP function works. After the Poisson distribution table is constructed, we can use =LOOKUP(RAND(), B2:B14,A2:A14) to generate the random numbers. Table 3 Illustration of Poisson Cumulative Distribution Table Generation It is obvious that the table lookup technique may also be used to generate binomial random numbers. The Poisson distribution often serves as an appropriate probability distribution for random variables representing the number of occurrences of some phenomenon during a fixed period of time. EXAMPLES OF SPREADSHEET SIMULATION A Capital Budgeting Example A simple capital budgeting problem is listed in Table 4. The net present value (NPV) spreadsheet model for the capital budgeting problem is presented in Table 5. After the formulas are entered into the cells C15, C16 and C17, the range C13:C17 can be copied to the columns on the right to generate additional simulations. For example, to generate additional 50 simulations, we can copy C13:C17 to D13:BA17. Statistics such as total, average, maximum, and minimum can be obtained easily with SUM, AVERAGE, MAX, and MIN functions, respectively. Additional runs for the same values of parameters can be carried out easily by simply pressing the CALC NOW (F9) key. Experiments for different values of the parameters can also be executed easily by entering their values into their respective cells. Table 4 A Capital Budgeting Problem Table 5 NPV Simulation Model A Cost-Volume-Profit Analysis Example of Spreadsheet Simulation A simple Cost-Volume-Profit Analysis Problem is given in Table 6 and its corresponding simulation model is presented in Table 7. This example introduces conditional probability. Conditional probability can be coded using either the IF function or a table lookup technique. We used the IF function here. For ease of presentation, the formula in cell B11 is shown in two lines. Again, the formulae in the range B8:B18 can be extended to generate additional simulations and statistical functions can be used to obtain summary statistics. Table 6 A Cost-Volume-Profit Analysis Problem Table 7 Cost-Volume-Profit Analysis Simulation Model CONCLUSION Simulation is widely used in accounting practice to analyze risk for a variety of types of problems. Developing and experimenting a simulation model on an electronic spreadsheet not only eliminates the need for learning a programming language and simplifies the model building process but also eases the experiments for different values of the parameters. This paper discusses the procedures for generating random numbers in the electronic spreadsheet environment and demonstrates the use of Microsoft Excel to develop two working simulation models without third-party add-ins. It clearly shows that spreadsheet simulation is useful, inexpensive, and easy to learn. REFERENCES AICPA Core Competency Framework for Entry into the Accounting Profession (The Framework), (n.d.) Retrieved June 18, 2009 from http://www.aicpa.org/edu/corecomp.htm. Bagchi, U., J. C. Hayya, J. C. & C. Chu (1986), “The Effect of Lead Time Variability: the Case of Independent Demand,” Journal of Operations Management, 6(2), 159-177. Blankley, Alan I., Philip G. Cottell Jr., & Richard H. McClure (2004, Quarter 3),” Rational Prediction Of Future Pension Expense: A Simulation Approach,” Journal of Applied Business Research, 20(3). Cascini, Karen T. & Anne J. Rich (2007, Quarter 2), “Developing Critical Thinking Skills In The Intermediate Accounting Class: Using Simulations With Rubrics,” Journal of Business Case Studies, 3(2). Gentle, James (2004), Random Number Generation and Monte Carlo Methods (Statistics and Computing) (2nd Edition), Springer, New York. Jabbour, George M. & Yi-Kang Liu (2005, September), “Option Pricing and Monte Carlo Simulations,” Journal of Business & Economics Research, 3(9). Kramer, Thomas A., J. M. Ragan, J. Gregory & J. Larkin (2008, September), “Business Warehouse Modeling Using SAP: Simulating A Business Case To Apply Strategic Enterprise Management To Accounting,” Journal of Business Case Studies,4(9). O’leary, Daniel E. (1983), “The Use of Simulation in Accounting: A Managerial Emphasis,” Proceedings of the IEEE Simulation Conference. Ragan, Joseph M., Andrew J. Hadley & Alexander P. Raymond (2008, March), “Star Electronics, Inc.: An Excel Based Case Using Financial Statement Analysis To Detect Fraud,” Journal of Business Case Studies, 4(3). Rich, Anne J. & Karen T. Cascini (2006, January), “The Impact of A Simulation Exercise in the Intermediate Financial Accounting Course,” Journal of College Teaching & Learning, 3(1). Schiff, Andrew D. & Margaret C. Smith (2008, March), “Margaret's Garden Shoppe: A Realistic Simulation of Accounting for Small Entities,” Journal of Business Case Studies, 4(3). Togo, Dennis F. (2007, Quarter 1), “Stochastic Risk Analysis of Budgeted Financial Statements,” Journal of Business Case Studies, 3(1). Togo, Dennis F. (2008, March), “Sunset Company: Risk Analysis for Capital Budgeting Using Simulation and Binary Linear Programming,” Journal of Business Case Studies, 4(3). Turney, Peter B.B. & Donald Watne (2003), Auditing EDP Systems (2nd Edition), Prentice Hall.