KutoolsforOffice — One Suite. Five Tools. Get More Done.February Sale: 20% Off

How to keep/stop random numbers from changing in Excel?

AuthorSunLast modified

When working with random number formulas in Excel, such as RAND() or RANDBETWEEN(), you may notice that the generated values automatically recalculate and produce new numbers every time the worksheet recalculates. Recalculation can be triggered not only by double-clicking cells, but also by editing cell contents, running calculations, or even opening the workbook. This behavior is often undesirable if you need to preserve a specific set of randomly generated data, for example when preparing datasets for reports, conducting experiments, or distributing shuffled information that should remain unchanged. Here, you’ll find several practical solutions to prevent random numbers from changing, so you can confidently use them for further analysis or sharing.

Stop random numbers changing by Copy and Paste

Stop random numbers changing by setting Calculation Options

Stop random numbers changing by using Insert Random Data of Kutools for Excel good idea3

Stop random numbers changing with VBA code


Stop random numbers changing by Copy and Paste

One of the simplest methods to make random numbers remain constant is by replacing the formulas generating them with their current values. This approach is especially useful when you want a quick solution and don't need to preserve formulas for future reference.

Begin by selecting the cells containing the random numbers that you wish to keep as fixed values. Press Ctrl + C to copy your selection. Next, choose where you want to paste the values—this can be in the original location or in another cell or worksheet. Right-click your target cell or range, then select Paste Special > Values (V) from the context menu. This action converts the formulas to static numbers, preventing further changes regardless of worksheet recalculation.

copy and paste the formula cells as Values

After performing paste as values, your random numbers are now plain values that will remain unchanged. If you need to apply this method to a large dataset, you can highlight the entire column or range and repeat these steps. This method is best for one-time data preservation, but keep in mind that you cannot recover the original formulas after converting them to values. Consider making a backup if you may need the formulas later.

a screenshot of kutools for excel ai

Unlock Excel Magic with Kutools AI

  • Smart Execution: Perform cell operations, analyze data, and create charts—all driven by simple commands.
  • Custom Formulas: Generate tailored formulas to streamline your workflows.
  • VBA Coding: Write and implement VBA code effortlessly.
  • Formula Interpretation: Understand complex formulas with ease.
  • Text Translation: Break language barriers within your spreadsheets.
Enhance your Excel capabilities with AI-powered tools. Download Now and experience efficiency like never before!

Stop random numbers changing by setting Calculation Options

Another way to keep random numbers from continuously changing is by adjusting Excel’s calculation mode. By default, Excel automatically recalculates formulas whenever any change occurs, which causes random formulas to update frequently. You can alter this behavior so that calculation only happens when you manually request it.

To do this, open your workbook and click the Formulas tab on the Excel ribbon. Then, select Calculation Options, and in the drop-down list, choose Manual.

check Manual from the Calculation Options commond

By switching the calculation mode to manual, Excel stops recalculating all formulas—including random number formulas—automatically. Your currently displayed random numbers will remain unchanged until you explicitly trigger a recalculation by pressing F9 or clicking Calculate Now.

Note:

This setting affects all formulas in the workbook and may delay updates in other cells that rely on dynamic formulas. Use this method when you want to maintain all currently displayed values, not just random numbers, for consistency. Remember to switch back to Automatic calculation when you want formulas to update regularly again to avoid overlooked changes. If only certain random number results need preservation, consider converting those specific cells to values as shown above.


Stop random numbers changing by using Insert Random Data of Kutools for Excel

If you prefer a more user-friendly and flexible approach, especially when generating random data for complex tasks or requiring unique random values, you can utilize the Insert Random Data feature in Kutools for Excel. This powerful function allows you to generate random integers, decimals, dates, text strings, and custom lists—all directly as static values, so they will not change after creation.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Itegarate with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

1. Select the range where you want to produce random numbers, then navigate to Kutools > Insert > Insert Random Data.
click Insert Random Data feature of kutools

2. In the Insert Random Data dialog box, choose the type of random data you wish to generate. For example, click on the Integer tab for whole numbers or the Decimal tab for fractional values. Enter your desired range in the From and To fields, such as numbers between 16 and 100. If you wish to prevent duplicates, check the Unique values box. Additional advanced settings allow you to generate random dates, strings, or predefined custom lists as needed.
set options in the dialog box

3. Click Ok to finalize and generate the random numbers in your selected cells. The inserted numbers are static values and will not change, even when you recalculate the worksheet or reopen the file.
random numbers are generated and keep from changing

This approach is especially advantageous when you need to produce various types of random data (not just numeric values) or when you want to ensure the generated random values remain unchanged for further analysis or record keeping. Kutools for Excel offers additional functionalities for generating random dates, text, or custom items. Click here for more details about it. If you ever need to generate random numbers again, simply repeat these steps, with flexible options to fit different scenarios.


Stop random numbers changing with VBA code

For advanced users or when working with large data sets, using a simple VBA macro can instantly convert all random number formulas to static values. This is especially useful for automating repeated tasks or when you frequently generate random data and need those values to be preserved for sharing or record keeping.

1. Click Developer Tools > Visual Basic. In the Microsoft Visual Basic for Applications window, click Insert > Module to add a new code module. Copy and paste the following VBA code:

Sub ConvertRandomNumbersToValues()
    Dim Rng As Range
    Dim cell As Range
    On Error Resume Next
    xTitleId = "KutoolsforExcel"
    Set Rng = Application.Selection
    Set Rng = Application.InputBox("Select random number range", xTitleId, Rng.Address, Type:=8)
    For Each cell In Rng
        If cell.HasFormula Then
            cell.Value = cell.Value
        End If
    Next cell
End Sub

2. After inserting the code, click the Run button button to run the macro. When prompted, select the cell range containing your random number formulas. The macro will instantly replace all formulas with their present values, stopping further changes due to recalculation.


In summary, the best solution depends on your specific needs—whether you’re making a one-off copy, adjusting calculation settings across the workbook, needing more tailored random data with Kutools for Excel, or seeking creative formula/VBA strategies for larger tasks. Always consider the implications of turning formulas into values or altering calculation options; make backups of your work as needed to prevent data loss or unintended changes. If you encounter problems such as formulas not locking correctly, random numbers not behaving as expected, or VBA macros not running, check Excel’s calculation settings, macro security, and workbook status for troubleshooting, and try alternative methods outlined above for greater reliability and control.

Relative Articles:

Best Office Productivity Tools

🤖Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |  Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |  Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

ExcelWordOutlookTabsPowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in