The RANDBETWEEN formula is the quiet workhorse behind a lot of business magic. It powers everything from fair lead routing and A/B test splits to randomized survey samples and training simulations. In Google Sheets and Excel, it returns an integer between a lower and upper bound, refreshing whenever the sheet recalculates. That volatility is useful for exploring scenarios, but it also means you need structure: fixed seeds, value-only copies, and guardrails so your reports don’t mysteriously change overnight.
Delegating RANDBETWEEN-heavy workflows to an AI computer agent unlocks a different level of control. Instead of manually typing formulas, dragging them down thousands of rows, and remembering when to paste-as-values, the agent can create, copy, lock, and document every randomization step for you at scale. It can run in both Google Sheets and Excel, orchestrate multi-step processes, and still keep a transparent log so your team knows exactly how every random number was generated.
If you run a business, agency, or sales team, RANDBETWEEN is probably hiding somewhere in your spreadsheets already. It’s the formula that quietly decides which leads get which offer, which prospects get called first, or which creative a contact sees. Used well, it brings fairness and experimentation into your operations. Used manually at scale, it burns hours.
Below are the top ways to use RANDBETWEEN effectively—first by hand, then with an AI agent that can take over the repetitive parts.
RANDBETWEEN’s syntax is simple:
=RANDBETWEEN(bottom, top)
Step-by-step in Google Sheets or Excel:
=RANDBETWEEN(1,100).Pros:
Cons:
Common use case: assign leads or tasks randomly to reps.
Example in Google Sheets or Excel:
=RANDBETWEEN(1,1000000).Now the list is randomized. You can slice the top 20 rows for a test group, or split evenly across your team.
Pros:
Cons:
Often you want RANDBETWEEN to generate numbers once, then stop.
In Excel:
=RANDBETWEEN(...).In Google Sheets:
Pros:
Cons:
For sales and marketing teams, a classic pattern is “pick one random item from a list.”
Formula: =INDEX(A2:A201, RANDBETWEEN(1, COUNTA(A2:A201)))
Step-by-step:
Pros:
Cons:
Manual RANDBETWEEN workflows fall apart when:
This is where an AI computer agent shines. Instead of you being the “macro” that clicks and copies, the agent becomes the operator: opening files, writing formulas, converting values, logging what happened, and doing it the same way every time.
Imagine describing a workflow like this to an AI agent:
Step-by-step at a high level:
bottom, top), and when to freeze values.Pros:
Cons:
Once an AI agent reliably handles RANDBETWEEN in one spreadsheet, you can scale horizontally:
At that point, RANDBETWEEN stops being “that little function someone knows” and becomes a controlled, documented part of your operating system—run by a tireless digital teammate instead of your own clicking hand.
Add your leads in column A. In column B, enter `=RANDBETWEEN(1,1000000)` and fill down for all rows. Sort by column B to randomize the order, then assign blocks of rows to each rep. When you’re happy, copy column B and paste as values so the random order doesn’t keep changing with every recalculation.
First, generate your random integers with RANDBETWEEN. Once you’re satisfied, select those cells and copy them. In Excel, use Paste Special > Values. In Google Sheets, use Edit > Paste special > Paste values only. This replaces the formulas with static numbers, so your randomized assignments or samples stay fixed even when other parts of the sheet recalc.
Place your list in A2:A101. In another cell, use `=INDEX(A2:A101, RANDBETWEEN(1, COUNTA(A2:A101)))`. COUNTA counts how many items you have, and RANDBETWEEN picks a random position within that range. INDEX then returns the item at that position. If you want to lock the choice, copy the result cell and paste it as a value.
List all users or leads in column A. In column B, use `=RANDBETWEEN(1,1000000)` and copy down. Sort by column B to shuffle. Assign the first half of rows to group A and the rest to group B. Finally, copy column B and paste as values so the assignment doesn’t change. Optionally add a column C with a simple IF formula to label each row A or B.
RANDBETWEEN is volatile, so lots of formulas can slow big models. Limit its use to helper columns, then convert results to values after each run. In Excel, consider using RANDARRAY to generate blocks of random integers at once. In Google Sheets, reduce recalculation frequency in File > Settings > Calculation, and archive old randomization columns you no longer need.