
In this tutorial, we will show how to use Excel to simulate real-world random events, including practical datasets for coin flips, dice rolls, and weather forecasting.
1. Simulate a Simple Coin Flip
Simulate flipping a coin 100 times.
Steps:
- Open a new Excel workbook.
- In cell A1, type Trial Number.
- In cell B1, type Coin Flip Result.
Fill in Trial Numbers:
- In cell A2, enter 1.
- In cell A3, enter 2.
- Select cells A2:A3 and drag the fill handle down to A101 to number trials from 1 to 100.
- If you are using Excel 2021 or later. You can use the SEQUENCE function.
- Select cell A2 and insert the following formula.
=SEQUENCE(100,1,1,1)
This formula automatically generates 100 trail number.
Simulate Coin Flips:
- In cell B2, enter the following formula:
=IF(RAND()<0.5, "Heads", "Tails")
This formula returns Heads if the random value is less than 0.5 other returns TAils.
- Drag the fill handle from B2 to B101.
Analyze Results:
Count Heads/Tails from the simulated result.
Count Heads:
- Select cell E2 and insert the following formula.
=COUNTIF(B2:B101, "Heads")
Count Tails:
- Select cell E3 and insert the following formula.
=COUNTIF(B2:B101, "Tails")
Note: Formulas generate new results every time the workbook recalculates.
2. Simulate Dice Rolls
Simulate rolling a six-sided dice 100 times.
Steps:
- In cell A1, enter Roll Number.
- In cell B1, enter Dice Result.
Fill in Roll Numbers:
- Select cell A2 and insert the following formula.
=SEQUENCE(100,1,1,1)
Simulate the Dice Rolls:
- Select cell B2 and insert the following formula
=RANDBETWEEN(1,6)
This formula creates random number between 1 to 6.
- Drag down the formula from B2 to B101.
Analyze Results:
Calculate frequency for each dice number (1 through 6):
- Number 1:
=COUNTIF($B$2:$B$101, 1)
- Number 2:
=COUNTIF($B$2:$B$101, 2)
- Number 3:
=COUNTIF($B$2:$B$101, 3)
- Number 4:
=COUNTIF($B$2:$B$101, 4)
- Number 5:
=COUNTIF($B$2:$B$101, 5)
- Number 6:
=COUNTIF($B$2:$B$101, 6)
Note: Formulas generate new results every time the workbook recalculates.
3. Simulate Customer Arrival (Practical Business Scenario)
You can simulate hourly customer arrivals at a store, assuming the average arrival rate is 20 customers per hour.
Steps
- In cell A1, enter Hour.
- In cell B1, enter Customers Arriving.
Fill Hours:
- In cell A2, insert 9:00 AM.
- Drag down for each hour until 4 PM.
Simulate Arrivals:
- In cell B2, insert the following formula.
=ROUND(NORM.INV(RAND(), 20, 4), 0)
This formula simulates a realistic random number (e.g., customer arrivals) centered around 20 with a standard deviation of 4. The result is rounded to the nearest whole number.
- Drag the formula from B2 down to B9.
Calculate Average Customers:
- Select cell D2 and insert the following formula.
=AVERAGE(B2:B9)
This generates realistic random arrivals based on a given average.
Note: Formulas generate new results every time the workbook recalculates.
4. Simulate Random Weather Conditions
You can simulate daily weather for a month based on historical probabilities.
Set probabilities:
- Sunny: 60%
- Cloudy: 25%
- Rainy: 15%
Steps:
- In cell A1, type Day.
- In cell B1, type Weather Condition.
Fill Days:
- Select cell A2 and insert the following formula.
=SEQUENCE(31,1,1,1)
Simulate Weather:
- In cell B2, insert the following formula.
=IF(RAND()<=0.6,"Sunny",IF(RAND()<=0.25/(0.25+0.15),"Cloudy","Rainy"))
This formula simulates random weather by assigning “Sunny,” “Cloudy,” or “Rainy” based on predefined probabilities, but it uses two RAND() calls, which may slightly distort the intended distribution. A better approach uses one RAND() with cumulative ranges.
- Drag the formula down to B32.
Analyze Results:
Count weather occurrences:
- Sunny:
=COUNTIF(B2:B32,"Sunny")
- Cloudy:
=COUNTIF(B2:B32,"Cloudy")
- Rainy:
=COUNTIF(B2:B32,"Rainy")
Frequency Analysis:
Calculate frequencies by dividing the counts by the total trials (31):
- Sunny:
=E2/31
- Cloudy:
=E3/31
- Rainy:
=E4/31
Note: Formulas generate new results every time the workbook recalculates.
5. Advanced Scenario: Monte Carlo Simulation for Sales Forecasting
Estimate monthly sales considering uncertainty. where:
- Expected sales: 2000 units
- Standard deviation: 300 units
Steps:
- In cell A1, enter Simulation #.
- In cell B1, enter Simulated Sales.
Fill Simulation Numbers:
- Select cell A2 and insert the following formula.
=SEQUENCE(1000,1,1,1)
Simulate Sales:
- In cell B2, insert the following formula.
=NORM.INV(RAND(), 2000, 300)
This formula generates a random value from a normal distribution with a mean of 2000 and a standard deviation of 300, it is useful for simulating monthly sales.
- Drag this formula down to B1001.
Analyze Results:
- Calculate average simulated sales.
=AVERAGE(B2:B1001)
- Calculate probabilities of exceeding a sales target (e.g., 2200 units):
=COUNTIF(B2:B1001,">2200")/1000
Note: Formulas generate new results every time the workbook recalculates.
Additional Tips:
- Lock Results: If you wish to keep your random results static, select the range, copy, and paste as values.
- Histograms and Visualizations: Use Excel’s charts to visualize simulation results easily.
- Use Data Analysis tool (Analysis ToolPak): For larger datasets and detailed statistical analysis.
- Freeze Panes: Freeze the top rows while creating large random events, which helps to scroll and understand the event easily.
- Press F9 to refresh random outcomes manually.
Conclusion
By following these detailed steps with practical datasets, you can confidently simulate and analyze random events using Excel. Excel’s powerful yet accessible random number functions like RAND(), RANDBETWEEN(), and statistical functions (NORM.INV, POISSON.INV) allow you to simulate real-world events effectively. Whether for educational purposes, forecasting, or risk management, Excel provides practical tools to visualize uncertainty and make informed decisions.
Get FREE Advanced Excel Exercises with Solutions!