Hey folks. Excuse the pun, but I don't exactly excel at math.
I need to build a sheet that simulates probability. For example, let's say it begins with a variable for "slot machine plays" that is either calculated elsewhere in the sheet or entered manually. Beside it is a column marked "big jackpot" with a certain percentage to "win" (let's say, 0.0014 probability). Rather than just divide and come up with a straight up number derived from the percentage, I'd like the "big jackpot" column to simulate the actual number of plays based on the original variable and come up with a random number of "wins" based on the win probability.
I'm sure this can be done, but it's beyond my Excel-fu abilities.
I had considered a solution like that, but unfortunately my sheet is a little too complicated to utilize that method. I'd go into details of the specifics, but when I explain what I do for a living, folks tend to look at me like I've grown a third eye
What I need to do, if possible, is have it all happen in a single cell. For example:
A1 contains the number of "tries"
B1 takes the number of tries and runs the probability (either based internally to the formula or pulled from a different cell) and returns the number of "wins" that occurred in that number of tries.
I've done things like this in C based programming languages using for loops and incrementing a variable, but I'm not sure Excel can do things that complex in a formula?
If it must all happen within a single cell, and you are already familiar with C programming, I would suggest that you turn your desired "simulator" into a User-defined function (http://www.excel-easy.com/vba/exampl...-function.html ) Since VBA is the programming language that comes bundled with Office, it is the most common language to use to cretae UDF's in Excel. Though, if you really wanted to, you can create them in C and call them in Excel: http://www.codeproject.com/Articles/...inedplusFuncti This latter option might be particularly interesting if you already have the code written in C and would only need to make it available to Excel.
Originally Posted by shg
Mathematics is the native language of the natural world. Just trying to become literate.
Doing some more digging through the Internet, it appears as though Google Sheets use Javascript as their scripting language, which I know quite a bit better than VBA. Might try this in Google Sheets.
Bookmarks