Tabellab

Random Arrivals: Inter-Arrival Times from the Exponential Distribution

Lesson 1 of 20Lab

All lessons

You are not signed in — the lab works, but your progress is not saved. Sign up

Lesson 1 of 20 is free. Unlock all 20 hands-on labs, the final exam and your certificate.

Buy course — CHF 9.90
Read first

From RAND() to a frozen run

To build your own simulation, type =RAND() in B7 and copy it down. Every change in the workbook then draws a new morning. When you want to report or compare one run, copy the u column and use Paste Special → Values so it stops changing. In newer Excel, =RANDARRAY(20) fills 20 numbers at once.

Loading the spreadsheet…

Why the line at the coffee counter is never "average"

A coffee kiosk serves 30 customers an hour, and one barista needs about a minute and a half per order. On paper that is easy: the barista is busy 75% of the time, so there should hardly ever be a line. Then Monday morning comes, four people arrive within a minute, the next one ten minutes later, and the kiosk owner wonders why customers complain about waiting when the average looks fine. The answer is randomness, and the best way to understand it is to simulate it.

This free first lesson is for operations and business analysts, students of operations research and statistics, shop and service managers, and anyone who plans staff for a counter, a call centre, a help desk or a loading dock. You need no statistics background beyond the idea of an average. By the end you can turn a column of random numbers into realistic gaps between customers, which is the first building block of every queue simulation, and you understand why most gaps are short and a few are very long.

We use the same fictional business as the lab above, the Copperleaf Coffee kiosk, with an arrival rate of 30 customers per hour and twenty random numbers that were drawn once and frozen, so everybody simulates the same morning and every cell can be checked.

The core concept: rate, gap and the exponential distribution

Customers who arrive independently of each other (nobody coordinates their visit with anybody else) are described by a constant arrival rate λ (lambda). At Copperleaf λ is 30 per hour, which is 0.5 per minute. Under this model, called a Poisson process, two things are true at once: the number of arrivals in an hour follows a Poisson distribution with mean 30, and the time between two consecutive arrivals, the inter-arrival time, follows an exponential distribution with mean 1/λ = 2 minutes.

The exponential distribution has a shape that surprises most people. Its most likely values are close to zero, and it has a long tail to the right. The probability that a gap is shorter than the mean is 1 − e−1, about 63%, so almost two out of three gaps are shorter than 2 minutes. The median gap is ln(2)/λ, about 1.39 minutes. To make up for so many short gaps, a few gaps are much longer than average. Its standard deviation is also 1/λ, as large as the mean, which tells you how irregular random arrivals really are. Short gaps arrive in clusters, and clusters are what build queues.

Another property makes the exponential distribution special: it is memoryless. If no customer has arrived for three minutes, the expected time until the next one is still 2 minutes. The kiosk is never "due" a customer. That is a good description of independent arrivals and a bad description of scheduled ones, such as patients with appointments, which is why you always check whether the model fits your situation.

Why variability, not the average, creates the line

Imagine for a moment that Copperleaf customers arrived like clockwork, exactly every 2 minutes, and that every order took exactly 1.5 minutes. The barista would be busy 75% of the time, and nobody would ever wait: each customer would find the counter free, because the previous order finished half a minute earlier. Now keep the same averages but let the gaps be random. Customers C05 to C08 in the lab arrive less than two minutes after C04, four of them in a row. With 1.5 minutes per order, for example, at least three of them have to wait, and the line they leave behind takes several minutes to clear.

This is the central lesson of queueing: waiting is caused by variability, in arrivals and in service times, and it grows sharply as the server gets busier. Averages hide it, a simulation shows it customer by customer. That is also why a spreadsheet simulation is worth building even when a textbook formula exists: you can see which customers wait, change one assumption and watch the effect, and explain the result to a manager who has never heard of queueing theory.

The inverse transform: from u to a gap

A spreadsheet can produce uniform random numbers between 0 and 1 with RAND(). To turn such a number u into an exponential gap, you use the inverse transform: solve the cumulative distribution F(t) = 1 − e−λt for t, which gives t = −LN(1 − u) / λ. Because u is equally likely to be anywhere between 0 and 1, the resulting t values follow exactly the exponential distribution. A small u gives a short gap, a u close to 1 a long one. Excel has EXPON.DIST for the cumulative probability but no built-in inverse, so this one-line formula is how every spreadsheet simulation does it.

Inverse transform: t = −LN(1 − u) / 0.5024680.00.20.40.60.81.0C09: u=0.388, t=0.98C01: u=0.514, t=1.44C19: u=0.864, t=3.99C17: u=0.958, t=6.34Random number u
The inverse transform for λ = 0.5 per minute. For most of the range of u the gap stays below 2 minutes, then the curve shoots up: C17 with u = 0.958 arrives 6.34 minutes after the customer before it, C09 with u = 0.388 after just 0.98 minutes.

Worked example: twenty arrivals at Copperleaf Coffee

The lab sheet keeps the assumptions at the top. B2 holds the rate per hour, B3 converts it to minutes, and B4 is the theoretical mean gap. Keeping units straight is the first rule of simulation: λ per minute gives gaps in minutes.

The assumption block of the lab
CellMeaningFormulaResult
B2Arrivals per hour (λ)given30
B3Arrivals per minute (λ)=B2/600.5
B4Theoretical mean gap 1/λ (min)=1/B32.00
B28Sample mean gap (min)=AVERAGE(C7:C26)1.80

Each customer then gets one random number in column B and one gap in column C. The formula in C7 is =-LN(1-B7)/$B$3, copied down to C26. The dollar signs keep the reference to the rate fixed while the row of u moves.

Copperleaf Coffee kiosk (fictional): the 20 given random numbers and their inter-arrival times at λ = 0.5 per minute
CustomerRowRandom u (B)Formula in CGap (min)
C0170.514=-LN(1-B7)/$B$31.44
C0280.728=-LN(1-B8)/$B$32.60
C0390.954=-LN(1-B9)/$B$36.16
C04100.049=-LN(1-B10)/$B$30.10
C05110.319=-LN(1-B11)/$B$30.77
C06120.116=-LN(1-B12)/$B$30.25
C07130.170=-LN(1-B13)/$B$30.37
C08140.173=-LN(1-B14)/$B$30.38
C09150.388=-LN(1-B15)/$B$30.98
C10160.446=-LN(1-B16)/$B$31.18
C11170.692=-LN(1-B17)/$B$32.36
C12180.389=-LN(1-B18)/$B$30.99
C13190.328=-LN(1-B19)/$B$30.79
C14200.541=-LN(1-B20)/$B$31.56
C15210.534=-LN(1-B21)/$B$31.53
C16220.732=-LN(1-B22)/$B$32.63
C17230.958=-LN(1-B23)/$B$36.34
C18240.362=-LN(1-B24)/$B$30.90
C19250.864=-LN(1-B25)/$B$33.99
C20260.270=-LN(1-B26)/$B$30.63

The sample mean of the twenty gaps is 1.80 minutes, a little below the theoretical 2.00. That is not an error. Twenty draws are a small sample, and with a standard deviation as large as the mean, a sample average of twenty values can easily be 10 or 20% off. In lesson 7 of the course you will see how many runs it takes until simulation and theory agree, and how to put a confidence interval around the result.

Look at the spread. 14 of 20 gaps are shorter than 2 minutes, close to the expected 63%. The shortest is 0.10 minutes, the longest 6.34. Customers C03 and C17 each arrive after a pause of more than six minutes, while C04 to C08 come in a burst of five customers within about two minutes. Added up, the twenty gaps cover 35.9 minutes, so in this frozen morning the 20th customer arrives at about 08:35 if the kiosk opens at 08:00. Building that clock is the subject of lesson 2.

Copperleaf kiosk: gap before each customer (minutes)012345671234567891011121314151617181920Customer C01 to C20shorter than 2 min2 min or longersample mean 1.80theory 1/λ = 2.00
The 20 gaps of the lab. Blue gaps are shorter than the 2-minute mean, peach ones longer. The dashed line is the sample mean (1.80 min), the solid line the theoretical mean of 2.00 min. Short gaps come in runs, which is when a line forms.

Observed vs expected gaps per one-minute bin04812107.90 to 1 min44.81 to 2 min32.92 to 3 min11.83 to 4 min22.74+ minobserved (20 given u values)expected: 20 × (e^(−λa) − e^(−λb))Most gaps are short, a few are long. The 20-customer sample follows the curve roughly.
Observed number of gaps per one-minute bin compared with the expected number from the exponential distribution, 20 × (e−λa − e−λb) for a bin from a to b minutes. With only 20 customers the match is rough but the shape is clear.

How to do it in Excel, step by step

  1. Set up the assumptions. Type the arrivals per hour in B2 (30). In B3 enter =B2/60 and in B4 =1/B3. Label every cell in column A; a simulation without labels is unreadable a week later.
  2. Create the customer list. Type C01 in A7 and drag the fill handle down to A26; Excel continues the series C02, C03 and so on. For larger runs type the first ID, select the range and use Home → Fill → Series.
  3. Draw random numbers. In B7 type =RAND() and fill down with Ctrl+D. In Excel 365 or 2021, =RANDARRAY(20) in B7 spills all twenty at once. In the lab the numbers are already given.
  4. Freeze a run you want to keep. Select B7:B26, copy with Ctrl+C, then Ctrl+Alt+V, V, Enter (Home → Paste → Paste Values). The numbers stop changing, so your report and your colleague see the same morning.
  5. Apply the inverse transform. In C7 type =-LN(1-B7)/, click B3 and press F4 to make it $B$3. Confirm and fill down to C26.
  6. Summarise. In B28 enter =AVERAGE(C7:C26) and compare it with B4. Add =MEDIAN(C7:C26), =STDEV.S(C7:C26) and =COUNTIF(C7:C26,"<2")/20 next to it to see the skew in numbers.
  7. Chart it. Select C6:C26 and use Insert → Charts → Clustered Column. For a histogram, use Insert → Statistic Chart → Histogram and set the bin width to 1 under Format Axis.
  8. Explore. Switch to automatic random numbers and press F9 a few times. Watch how the sample mean jumps around 2 and how the long gaps move. If the workbook becomes slow, set Formulas → Calculation Options → Manual and recalculate with F9 when you want.

Spreadsheet queue simulation for a coffee kiosk with random numbers, inter-arrival times and a waiting line
The course builds a complete coffee-kiosk simulation in a spreadsheet. This lesson creates its first column: when each customer arrives.

Should you write -LN(1-u) or -LN(u)? Both produce exponential gaps, because 1 − u is just as uniform as u. -LN(1-u) is safer with RAND(), which can return exactly 0 but never 1, so the logarithm never sees zero. It also keeps the intuitive direction: a larger u gives a longer gap. The lab uses -LN(1-u), so stick to it there.

How long should a simulation run be?

Twenty customers are enough to learn the mechanics and to check every cell, but not enough to make a staffing decision. A single short run can be lucky or unlucky, as the 1.80-minute sample mean shows. In practice analysts do two things. They simulate longer periods, for example a full morning or a full day of arrivals, and they repeat the run many times with fresh random numbers, then look at the average of the results and how much it varies between runs. If the answer changes noticeably from run to run, the run is too short or there are too few repetitions.

A second detail matters when the kiosk opens with an empty counter. The first customers never wait, so the start of a run looks better than a busy steady state. For questions about the rush hour itself, you either simulate from a little before the rush or ignore the first customers when you calculate averages. Lesson 7 of this course shows how to compare many runs with a confidence interval, so you know when you have simulated enough.

Common mistakes and how to spot them

  • Mixing hours and minutes. =-LN(1-B7)/B2 divides by 30 per hour and gives gaps in hours, about 0.03 each. Spot it: the sample mean should be close to 60/30 = 2. If it is 0.03 or 60, a unit is wrong.
  • Multiplying by λ instead of dividing. =-LN(1-B7)*$B$3 gives a mean of 0.5 instead of 2. Spot it: compare B28 with B4; they should be in the same range.
  • A relative reference to the rate. Without the dollar signs, row 8 divides by B4, row 9 by B5 and so on. Spot it: click C26 and check that the formula still points to $B$3.
  • Forgetting the minus sign. The logarithm of a number below 1 is negative. Spot it: negative gaps are impossible, so a quick =MIN(C7:C26) must be positive.
  • Reporting a run that keeps changing. With live RAND() every edit draws a new morning, so a number in your email no longer matches the workbook. Spot it: press F9; if the result you reported changes, paste the random numbers as values first.
  • Using the exponential model for scheduled arrivals. Appointments, bus timetables or a class that ends at 10:00 do not produce independent arrivals. Spot it: plot real gaps from your data. If they cluster around one value instead of piling up near zero, the exponential assumption does not fit.

Quick reference: functions and shortcuts

Quick reference: Excel functions and shortcuts for random arrivals
Function or shortcutWhat it doesExample
RAND()Uniform random number, at least 0 and below 1, new on every recalculation=RAND()
RANDARRAY(rows)Spills many uniform numbers at once (Excel 365 and 2021)=RANDARRAY(20)
LN(x)Natural logarithm, the core of the inverse transform=-LN(1-B7)/$B$3
EXPON.DIST(x, λ, TRUE)Probability that a gap is at most x minutes=EXPON.DIST(2,0.5,TRUE) = 0.632
AVERAGE, MEDIAN, STDEV.SSummarise the simulated gaps=AVERAGE(C7:C26)
COUNTIF(range,"<2")Counts the short gaps=COUNTIF(C7:C26,"<2") = 14
F9Recalculates the workbook and draws new random numbersA new simulated morning
Ctrl+Alt+V, then VPaste Special, Values: freezes a runTurn RAND() into fixed numbers
F4Makes a reference absolute while you type itB3 → $B$3
Ctrl+DFills the formula down a selected rangeSelect C7:C26, press Ctrl+D

Real-world uses

  • Retail and food service. A café, bakery or ticket counter simulates a busy hour before deciding whether a second staff member or a second till pays off.
  • Call centres and help desks. Calls and tickets arrive at random. Simulating arrivals at different rates per half hour shows when the service level breaks down and how many agents a shift needs.
  • Healthcare. Walk-in patients at an emergency department or a vaccination centre are often modelled as random arrivals, which helps to plan triage and waiting-room capacity.
  • Logistics. Trucks arriving at a warehouse dock without slot booking, parcels arriving at a sorting station or orders arriving in a web shop can all be simulated with the same column of gaps.
  • IT systems. Requests to a server or jobs in a print or batch queue arrive at random. A simple simulation shows why a system at 90% load feels much slower than one at 70%.

What you will build in the rest of this course

This first lab is free. The remaining 19 labs belong to the full course, a one-time purchase of $9.90, and they turn the column of gaps you just built into a complete, decision-ready model of the Copperleaf kiosk.

The Arrival Clock: Running Sums & Clock Times. You add the gaps up into arrival times, turn them into real clock times after the 08:00 opening and count how many customers arrive in the first half hour.

Service Times: Exponential & Normal Draws from Given Random Numbers. You draw how long each order takes in two ways, exponential and normal with a minimum, and compare the share of long services with theory.

The Single-Server Queue Table: Start, Wait & Finish. The heart of every queue simulation. For each customer you calculate when service starts, when it ends, how long they waited and how long they spent at the kiosk.

Queue Performance: Average Wait, Utilisation & Queue Length. You summarise the morning in the four numbers every queueing study reports and chart the waiting time customer by customer.

Two Servers: Sending Each Customer to the Next Free Barista. You add a second barista to the same morning, send each customer to whoever is free first and measure how much the average wait drops.

Simulation vs. Theory: M/M/1 Formulas & Confidence Intervals. You calculate the textbook waiting time for the kiosk, average ten longer runs and test with a confidence interval whether simulation and formula agree.

Staffing What-If: Barista Cost vs. Waiting Cost. You put a price on waiting, add staff cost for one, two and three baristas and pick the cheapest option, with a stacked column chart that makes the trade-off visible to any manager.

Summary

Random, independent arrivals are described by a rate λ, and the gaps between them follow an exponential distribution with mean 1/λ. The inverse transform =-LN(1-u)/λ turns any uniform random number into such a gap. At Copperleaf, λ = 0.5 per minute gives a theoretical mean of 2 minutes, the twenty frozen numbers give a sample mean of 1.80, and most gaps are short while a few are long. That uneven rhythm is the reason queues form even when the average load looks harmless.

Now scroll up to the lab and fill in B3, the twenty gaps in column C, the theoretical mean in B4 and the sample mean in B28. It takes about fifteen minutes, the Coach checks every cell live, and you will have the first column of a working queue simulation.

Frequently asked questions

How do I generate exponential random numbers in Excel?

Excel has no inverse exponential function, so use the inverse transform =-LN(1-RAND())/lambda. With lambda per minute the result is a random time in minutes with mean 1/lambda.

Why are inter-arrival times exponentially distributed?

If customers arrive independently at a constant average rate, the arrivals form a Poisson process, and the time between two consecutive arrivals follows an exponential distribution. Scheduled arrivals such as appointments do not follow this model.

What is the difference between the arrival rate and the inter-arrival time?

The arrival rate λ counts customers per unit of time, for example 30 per hour. The mean inter-arrival time is its reciprocal, 1/λ, here 2 minutes between customers.

How do I stop RAND() from changing in Excel?

Copy the cells and paste them as values with Ctrl+Alt+V, then V. You can also switch to manual calculation under Formulas, Calculation Options, but pasting values is the safer way to freeze a run you want to report.

Why is my simulated average not exactly equal to 1/λ?

A simulation draws a random sample, and with only 20 gaps the sample mean can differ noticeably from the true mean. More customers or more simulation runs bring the average closer to 1/λ.

Can I use the Analysis ToolPak to create exponential random numbers?

The Random Number Generation tool in the Analysis ToolPak offers distributions such as uniform, normal and Poisson but not exponential. Generate uniform numbers and apply =-LN(1-u)/lambda to them.

Keep going: Queue Simulation with Spreadsheets: Arrivals, Service Times & Waiting Lines

This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time CHF 9.90.

  1. The Arrival Clock: Running Sums & Clock Times
  2. Service Times: Exponential & Normal Draws from Given Random Numbers
  3. The Single-Server Queue Table: Start, Wait & Finish
  4. Queue Performance: Average Wait, Utilisation & Queue Length
  5. Two Servers: Sending Each Customer to the Next Free Barista
  6. Simulation vs. Theory: M/M/1 Formulas & Confidence Intervals
  7. Staffing What-If: Barista Cost vs. Waiting Cost
  8. Lunch Peak: Arrivals with a Rate That Changes During the Day
  9. Warm-Up Bias: Why the First Customers Lie About the Average
  10. Walk-Aways: Customers Who See the Line and Leave
  11. Order Mix: Discrete Service Times from a Menu Table
  12. Triangular Service Times: Simulating from Three Estimates
  13. Comparing Two Designs: Paired Runs & Common Random Numbers
  14. Batch Means: Confidence Intervals from One Long Run
  15. Kingman's Formula: Utilisation, Variability & the Hockey-Stick Curve
  16. Service Levels & Percentiles: Beyond the Average Wait
  17. Queue Length Over Time: Snapshots of the Line
  18. Hour-by-Hour Staffing: Baristas per Hour from a Demand Forecast
  19. Final Project: Simulation Dashboard for a Second Kiosk

Buy course — CHF 9.90 See the full course