How to Replace Slashes with Numbers and Generate Random Numbers in Excel
Question details
The user wants to replace forward slashes and backslashes with specific numbers and automatically generate random numbers for a raffle in Excel.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Cleaning formatted raw data containing slashes and assigning randomized numbers for a raffle or selection process.
- Observed behavior
- Needs to apply bulk replacements for symbol formatting and output static random numeric values.
Ensure you highlight only the specific data range before performing the Find and Replace operation, so you do not accidentally alter dates or formulas elsewhere in the worksheet.
Use Find & Replace and Random Functions
This method uses the built-in Find & Replace tool to swap slashes for numbers, followed by Excel formulas to generate static random values.
Excel handles bulk text and symbol replacements natively through the Find and Replace dialog. For randomization, the RAND and RANDBETWEEN functions can instantly generate numbers, but their results will recalculate continuously unless locked using Paste Special.
Select the required range of cells where the slashes are located. Press the keyboard shortcut Ctrl+H to open the Find and Replace dialog box.
In the 'Find what' field, type a forward slash (/). In the 'Replace with' field, enter your desired replacement number. Click 'Replace All'.
Clear the previous entries. Type a backslash in the 'Find what' field and a different number in the 'Replace with' field. Click 'Replace All' again.
Click an empty cell and enter the formula =RANDBETWEEN(1,100) to generate a random whole number between 1 and 100. If you need a decimal between 0 and 1, use =RAND() instead. Drag the fill handle to apply the formula to multiple cells.
Because random formulas recalculate every time the sheet updates, you must freeze them. Highlight the generated random numbers, press Ctrl+C to copy them, right-click the same selection, and select 'Paste Special' > 'Values' (the icon with 123).

Easily Replace Characters and Generate Random Numbers in WPS Spreadsheet
WPS Office provides powerful and intuitive data processing tools, including Find & Replace and comprehensive built-in functions like RANDBETWEEN, making bulk data manipulation simple.
- 1. Access Find and Replace: Open your workbook in WPS Spreadsheet, select your data, and press Ctrl+H to bring up the Find and Replace dialog.
- 2. Execute the Replacement: Input your slash in the 'Find what' box and the replacement number in the 'Replace with' box, then click 'Replace All'.
- 3. Apply the Random Formula: Type =RANDBETWEEN(1,100) in an empty cell to generate your random raffle numbers and press Enter.
- 4. Paste as Values: Copy the cells containing the random numbers, right-click them, and choose 'Paste as Values' to prevent them from changing when the document is edited.

Frequently Asked Questions
How do I stop random numbers from changing in Excel?
Random numbers generated by RAND or RANDBETWEEN are volatile functions that change upon any recalculation. To stop this, copy the cells containing your random numbers, right-click, and select 'Paste Special' > 'Values'. This replaces the formulas with static text.
What is the difference between RAND and RANDBETWEEN?
The RAND() function generates a random decimal number between 0 and 1, requiring no arguments. The RANDBETWEEN(bottom, top) function generates a random whole integer between the two specific numbers you set in the formula.
Can I limit Find and Replace to a specific column?
Yes. Before pressing Ctrl+H to open the Find and Replace menu, highlight the specific column or range of cells. Excel will only apply the replacement to the selected area.
Will replacing slashes affect date formats in Excel?
Yes, if your dates use slashes (e.g., 01/12/2024), using 'Replace All' on the entire sheet will alter them. To avoid this, select only the specific cells or columns containing the text you want to change before replacing.




