Pinterest Pixel

Quick Excel Tricks: Random Phone Number Generator in Excel

Master Excel: Learn how to generate random phone numbers with functions & filters No coding needed for... read more

Download Excel Workbook
John Michaloudis
Posted on


Quick Excel Tricks: Random Phone Number Generator in Excel | MyExcelOnline Quick Excel Tricks: Random Phone Number Generator in Excel | MyExcelOnline

When working with datasets or testing applications, a random phone number generator can be an invaluable tool. Microsoft Excel offers powerful functions to create random and seemingly authentic phone numbers with ease. By employing simple formulas or the program’s built-in random number functions, users can efficiently produce a random series of phone numbers tailored to their needs.

Key Takeaways

  • Random phone numbers are crucial for various quantitative scenarios such as database testing, anonymized dataset creation, and telecommunication.
  • Excel provides powerful built-in functions like RAND() and RANDBETWEEN() for generating random numbers, using deterministic processes to produce seemingly random outputs.
  • Custom number formatting in Excel helps to present phone numbers according to regional standards, enhancing readability and professionalism in data presentation.
  • Techniques such as removing duplicates and adhering to country-specific formats are essential for ensuring uniqueness and legal compliance.

Download the spreadsheet and follow the tutorial on Random Phone Number Generator in Excel – Download excel workbookRandom-Phone-Number-Generator.xlsx


Getting Started with Random Phone Numbers in Excel

Understanding the Need for Random Phone Numbers

Random phone numbers are instrumental in different quantitative scenarios such as testing databases, creating anonymized datasets, running simulations for telecommunications projects, and more. Randomization helps ensure that phone number generator do not carry any inherent biases that might skew the outcome of any analysis or test.

The Basics of Excel Functions for Randomization

Excel’s built-in functions for random number generation are quite powerful when used correctly. At their simplest, RAND() generate a random decimal number between 0 and 1, and RANDBETWEEN(top, bottom) generate a random integer between the specified top and bottom values. These functions harness a pseudo-random algorithm, which means they produce numbers that seem random by certain statistical criteria but are generated with deterministic processes.

The RAND() function can be particularly interesting as it’s consistently recalculated whenever the worksheet changes or is opened. However, by coupling RAND() with other functions, we can produce a broader range of pseudo-random outputs, including telephone numbers.


Step-by-Step Guide to Generate Random Phone Numbers

Using the RAND Function to Start the Process

To begin generating random phone numbers, we start with the RAND function. Here is a step-by-step guide:

STEP 1: Select a cell in your Excel sheet where you want the random number to be generated, such as cell A2.

phone number generator

STEP 2: Type =RAND() into the cell and press Enter.

phone number generator

STEP 3: Excel will now produce a random decimal number between 0 and 1 in cell A1.

phone number generator

Notice that because RAND is volatile, every time there’s a recalculation on the sheet, the number in the cell will change. To generate a series of random decimal numbers, you can drag the corner of cell A1 downwards to fill more cells.

These random decimals will serve as the foundation for creating random phone numbers. The generated numbers will still need to be formatted and refined to meet the criteria for phone numbers, which we’ll cover in the subsequent steps.


Creating a Phone Number Format with Text Functions

To create phone numbers from the results produced by the RAND() function, you’ll need to turn those random decimal values into a string that looks like a phone number. Here’s how to do it:

STEP 1: After generating a column of random decimal numbers using =RAND(), next to the first random decimal in cell B1, input the formula =TEXT(RAND()*9E9,"0000000000"). This multiplies the random decimal by 9,000,000,000 (which is 9 followed by nine zeros, the same number of digits as in a standard U.S. phone number without the area code), and then formats it as a ten-digit number.

phone number generator

STEP 2: Press Enter, and the cell will now display a ten-digit number formatted as a string, without any decimals.

STEP 3: To add further formatting, such as dashes, parentheses around area codes, or country codes, use Excel’s CONCATENATE function or the & operator. For instance, if you want to format the number with dashes, you would use ="(" & LEFT(A2,3) & ") " & MID(A2,4,3) & "-" & RIGHT(A2,4). This takes the first three numbers as an area code, the next three as the middle digits, and the last four as the final part of the phone number.

phone number generator

STEP 4: Fill down the formula to create as many random phone numbers as needed. Select the cell with your new formula, and drag the fill handle across the range of cells where you want phone numbers to be populated.

phone number generator

These functions can be combined in various ways to achieve the desired phone number format. Remember to create formats that are consistent with phone number standards in the relevant country or region.


Formatting and Final Touches

Converting Formulas to Static Values

Converting formulas by random phone number generator to static values is a critical step, particularly in Excel, where formulas can recalculate and change the values dynamically. Here’s how you can ‘freeze’ the random numbers:

STEP 1: Click on the cell containing your formula-based random phone numbers. Press Ctrl + C to copy the cells or right-click and select ‘Copy.

phone number generator

STEP 2: Press Alt + E + S to open ‘Paste Special‘ dialog box and choose ‘Values’ from the options.

phone number generator

This process replaces the formulas that generate random phone numbers with the actual numbers they produce at the moment of conversion. It prevents any future recalculations from affecting the set of numbers you’ve established.

phone number generator

Remember to perform this action only when you are satisfied with the list of random numbers and are ready to fix them in place.


Customizing the Appearance of Phone Numbers in Excel

Customizing the appearance of phone numbers in Excel can make data more readable and align with regional standards of presentation. Here’s how to customize the appearance of random phone numbers:

STEP 1: Right-click on the cell or range of cells containing the phone numbers. Select ‘Format Cells‘ from the context menu.

phone number generator

STEP 2: In the ‘Number’ tab, choose ‘Custom’.

phone number generator

STEP 3: Enter a custom code in the ‘Type’ box to format the number. For example, you might use “[<=9999999]###-####;(###) ###-####”.

phone number generator

The correct format for the random phone number will be displayed.

phone number generator


Tips and Tricks for Phone Number Generator

Avoiding Duplicates with Advanced Excel Techniques

Ensuring that each generated phone number is unique is essential for many applications, such as creating contact lists or assigning identifiers. Unfortunately, Excel’s random functions can and will produce duplicates on occasion, so additional steps are needed to weed these out.

Here’s how to remove duplicates when generating random phone numbers:

STEP 1: To eliminate duplicates, use Excel’s ‘Remove Duplicates‘ feature, which is found under the Data tab. Select your range of phone numbers, click on ‘Data’ in the ribbon, then select ‘Remove Duplicates’.

phone number generator

STEP 2: Make sure the ‘My data has headers’ option is unchecked if your data does not include headers, then press ‘OK’.

phone number generator

The duplicate values, if any, will be removed.

Adhering to Country-Specific Formats

Different countries have various formats and rules for telephone numbers, which can include different lengths, specific starting digits, or the inclusion of special codes. Adhering to these formats is critical when generating phone numbers to be used for global datasets or applications.

Here are some steps and considerations for sticking to country-specific formats:

  • Research Country Formats: Research the format for telephone numbers in the country of interest. Look for things like the total number of digits, any required prefixes (like ‘1’ for long-distance calls in the USA), and any area code restrictions.
  • Adapt Random Number Generation: Adjust the RANDBETWEEN function to produce the correct number of digits for the country’s local numbers. For example, some countries may have 7 or 8 digits local numbers after the country and area codes.

phone number generator

  • Account for Prefixes and Country Codes: Include the country code at the beginning of your generated number. For example, in the UK, you might preface your numbers with ‘+44’, while in Australia, you’d use ‘+61’.
  • Utilize Formatting Functions: Make use of Excel’s TEXT function to ensure that all numbers meet the required format, including any leading zeros.
  • Ensure Legal Compliance: Always check that any generated data abides by the laws and regulations of the country, particularly regarding privacy and telecommunications standards.
  • Create Format Templates: For repetitive tasks, consider creating separate templates for each country and automate as much of the formatting process as possible using Excel functions.

By keeping these considerations in mind and adapting your random number generation to fit specific formats, you’ll be able to create phone numbers that are much more suitable for international applications. Be mindful of keeping the process adaptable, as telephone numbering plans can evolve over time.


FAQ: Working with Random Numbers in Excel

How can I prevent random numbers from recalculating?

To prevent random numbers from recalculating in Excel, select the cells containing the RAND function or RANDBETWEEN functions and press `Ctrl` + `C` to copy them. Then, right-click on the selected range, choose `Paste Special > Values` to convert the formulas to static numbers. This replaces the formulas with their current values, ensuring they no longer change with sheet recalculations.

Can I generate random phone numbers for specific countries?

Yes, you can generate random phone numbers for specific countries using Excel by adhering to the correct formats and rules for phone numbers in those countries. Here’s how to do it – Use Excel functions like CONCATENATE or the & operator to combine the country code, area code, and local number into a complete phone number. For example, ="+1-" & TEXT(A2,"(000)") & "-" & TEXT(B2,"000-0000") where A2 contains the area code and B2 contains the local number.

Is there a way to randomly generate numbers in Excel?

Yes, Excel provides several ways to randomly generate numbers, using either basic functions that require no coding or more advanced methods involving VBA scripting. Here are a few simple, non-coding methods to generate random numbers:

  1. RAND Function: This function generates a random decimal number between 0 and 1. Simply type =RAND() into a cell and press Enter.
  2. RANDBETWEEN Function: This function generates a random integer between two specified values. For example, =RANDBETWEEN(1, 100) will produce a random number between 1 and 100.
  3. RANDARRAY Function (Excel 365): The RANDARRAY function can create an array of random numbers. You can specify the number of rows and columns, as well as if you want integers, using the RANDBETWEEN function as an argument.
  4. Data Analysis Toolpak: If you have the Data Analysis Toolpak enabled, you can use the ‘Random Number Generation’ tool to produce several random numbers based on various distributions.
If you like this Excel tip, please share it
Quick Excel Tricks: Random Phone Number Generator in Excel | MyExcelOnline Quick Excel Tricks: Random Phone Number Generator in Excel | MyExcelOnline
Founder & Chief Inspirational Officer at

John Michaloudis is a former accountant and finance analyst at General Electric, a Microsoft MVP since 2020, an Amazon #1 bestselling author of 4 Microsoft Excel books and teacher of Microsoft Excel & Office over at his flagship MyExcelOnline Academy Online Course.

See also  How to Type Square Root in Excel - Step by Step SQRT Function Guide

Get Video Training

Advance your Microsoft Excel & Office Skills with the MyExcelOnline Academy!

Dramatically Reduce Repetition, Stress, and Overtime!
Exponentially Increase Your Chances of a Promotion, Pay Raise or New Job!

Learn in as little as 5 minutes a day or on your schedule.

Learn More!

Share to...