How to Use RAND Function in Excel

If you just need to use rand function in excel and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: use =RAND() — it returns a random decimal from 0 up to (but not including) 1, recalculating on every change in the workbook.

On this page8

Syntax

=RAND()

Arguments

Argumentrequired / optionalDescription
randoptionalRAND takes no arguments — the empty brackets are required.

Related functions

RANDBETWEENINTMOD
▤Annotated stepsExcel
1

Select the cell or range and type =RAND() — the empty brackets are part of the name.

2

Press Ctrl+Enter to fill a whole selection at once.

3

To scale it, multiply by the size of the range you want and add the minimum.

4

Copy and Paste Special → Values to freeze the results before relying on them.

Ctrl+CthenCtrl+Shift+V⌘+Cthen⌘+Ctrl+VPaste values · WindowsMac

What this does

RAND returns a uniformly distributed decimal between 0 and 1. Taking no arguments, it is scaled by arithmetic: multiply by a span and add a floor to get any range. Its most useful property in practice is as a shuffling key — putting =RAND() beside a list and sorting by that column randomises the order, which is how you draw a sample without replacement. Like all random functions it is volatile and recalculates constantly, so anything meant to stay put must be frozen as values. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. Treat “use rand function in excel” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected formula shows up while it is still harmless. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That turns a calculation you can defend to a CFO or an auditor into a method you can reuse, explain, and defend when the workbook leaves your screen.

A worked example

A random decimal between 10 and 20: =RAND()*10+10. Shuffling a list: put =RAND() in column B beside the names in column A, then sort by column B. Assigning a random 30 % of rows to a test group: =IF(RAND()<0.3, "Test", "Control"). RAND is the general randomness primitive — sampling, shuffling and split-testing all reduce to it plus a comparison. Check the referenced cells, argument order and result type in your workbook. Start with the worked example before changing an input, then compare the changed result with the calculation you expected. An error value or a result of a different type is a reason to inspect the inputs and arguments.

In Google Sheets

Google Sheets support for this task has not been verified. Check the function, arguments and workflow in the target product before transferring the example. Matching formula notation does not establish identical behaviour. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. For “use rand function in excel”, keep the input cells and the result visible while you check the formula in Excel. Follow the worked example and change one input at a time. The steps explain the workbook calculation; this page does not run a live calculator for that task.

Common mistakes

  • Forgetting the empty brackets; =RAND without them is read as a name and returns #NAME?.
  • Sorting a list by a live RAND column, which reshuffles as the sort recalculates — freeze the values first.
  • Using RAND where whole numbers are wanted; RANDBETWEEN does that directly.

Frequently asked questions

How do I get a random number in a specific range?

=RAND()*(max-min)+min gives a decimal in that range. For integers, use =RANDBETWEEN(min, max).

How do I shuffle a list?

Add a helper column of =RAND(), freeze it as values, then sort the list by that column.

Why do my random numbers keep changing?

RAND is volatile and recalculates whenever anything in the workbook changes. Paste Special → Values to fix them.

Other ways people ask this

This is also commonly searched as “excel function rand” and “excel rand function”. They describe the identical operation, so you are in the right place no matter how you phrased it.

Why do people search for this in so many different ways?

Because the same task has many names. “excel function rand”, “excel rand function” all point at the one operation explained on this page, which is why they all lead here.