Generate 125 Random Numbers With a Fixed Sum in Excel
Question details
Generate 125 random values between 1.1 and 2.1 with a total of 245.

- Product
- Microsoft Excel and WPS Spreadsheets
- Device & OS
- not provided
- Scenario
- A spreadsheet needs a set of random values that meets both individual limits and a fixed total.
- Observed behavior
- The desired values must average 1.96, so many will need to be close to the upper limit of 2.1.
Open a blank worksheet and make sure cells B1:C126 are available. The target is feasible because 125 × 1.1 ≤ 245 ≤ 125 × 2.1.
Generate Values Sequentially Using Feasible Bounds
Use this method in Excel or WPS Spreadsheets to keep enough of the remaining total available for every subsequent value.
Each formula chooses a random value within the range that still allows the remaining positions to reach the target. This sequential method does not sample all valid sets uniformly, and earlier values can affect later values.
Type 245 in cell C1. This cell holds the starting amount remaining.
Enter this formula in B2: =MAX(1.1,C1-(126-ROW())*2.1)+RAND()*(MIN(2.1,C1-(126-ROW())*1.1)-MAX(1.1,C1-(126-ROW())*2.1))
Enter =C1-B2 in C2. This subtracts the generated value from the amount remaining.
Select B2:C2 and drag the fill handle down through row 126. Cells B2:B126 now contain 125 values.
In empty cells, enter =SUM(B2:B126), =MIN(B2:B126), and =MAX(B2:B126). The sum should be 245, subject to spreadsheet floating-point precision.

Generate a Fixed-Sum Random List in WPS Spreadsheets
Use RAND and a running remainder in WPS Spreadsheets to create 125 bounded random values that add up to the target.
- 1. Set the target: Open a blank sheet in WPS Spreadsheets and enter 245 in C1.
- 2. Enter the random formula: In B2, enter =MAX(1.1,C1-(126-ROW())*2.1)+RAND()*(MIN(2.1,C1-(126-ROW())*1.1)-MAX(1.1,C1-(126-ROW())*2.1)).
- 3. Calculate the remainder: In C2, enter =C1-B2, then select B2:C2 and drag the fill handle through row 126.
- 4. Verify the list: Use =COUNT(B2:B126) and =SUM(B2:B126) in empty cells to check the 125 values and their total.

Frequently Asked Questions
Why does RAND alone not produce a total of 245?
A formula such as =1.1+RAND() calculates each value independently, so the total is not constrained. The sequential formula limits each choice based on the remaining target and number of values.
How can I keep the generated values from changing?
Select B2:B126, copy the cells, and use Paste Special > Values to replace the formulas with their current results. Copy the values before recalculating the worksheet.
Why do the displayed values sometimes not add up to exactly 245?
The spreadsheet stores numbers with finite precision, and formatting can round each displayed value. Check =SUM(B2:B126) and increase the displayed decimal places to inspect the result.
Will every valid set of 125 values be equally likely?
No. The sequential method chooses each value from its current feasible range, so the order of the choices affects the distribution. A uniform sample of valid sets requires a different sampling method.




