Make Excel RANDARRAY Values Add Up to a Fixed Total
Question details
Generate an array of random values that adds up to a predetermined total.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user wants to use RANDARRAY to distribute a target amount, such as 500, across random values.
- Observed behavior
- The desired result is an array of random values whose sum equals the target total.
Check that your version of Excel supports RANDARRAY, LET, and dynamic arrays. Leave enough empty cells below the formula for the results to spill.
Normalize a RANDARRAY to the target total
Use LET to generate the random values once, then scale them so their total is 500.
Select an empty cell and enter =LET(values,RANDARRAY(20),total,SUM(values),values/total*500).
Press Enter to spill 20 values down the column. In another cell, use SUM on the spilled range to check the total.
Edit the formula to replace 20 with the number of values you need and 500 with your target. You can also use cell references for these inputs.

Create random values with a fixed total in WPS Spreadsheets
Use RAND and SUM in WPS Spreadsheets to generate and scale random values to a target total.
- 1. Set the target: Open a worksheet in WPS Spreadsheets and enter 500 in cell B1.
- 2. Generate random values: Enter =RAND() in cell A1, then fill the formula down through A20.
- 3. Scale the values: Enter =A1/SUM($A$1:$A$20)*$B$1 in C1, then fill the formula down through C20.
- 4. Verify the total: Enter =SUM(C1:C20) in an empty cell to check the total. The random values change when the worksheet recalculates.

Frequently Asked Questions
Can I use a cell for the target total?
Yes. If the target is in B1, replace 500 in the LET formula with B1. You can also replace 20 with a cell reference containing the desired number of values.
Why do the random values keep changing?
RANDARRAY recalculates when Excel recalculates the worksheet. To keep a set of results, copy the spilled cells and use Paste Special > Values to replace the formulas with their current values.
Why does Excel show a spill error?
The formula needs 20 empty cells in its output column. Clear any content blocking the spill range, then enter the formula again if necessary.
Will rounded values still add up to exactly 500?
Not necessarily. Rounding each result independently can change the displayed sum. If exact rounded totals are required, calculate an adjustment for the rounding difference.




