How to Enforce 10-Digit Unique Phone Numbers in Excel using Data Validation
Question details
The user needs to restrict Excel cell inputs to exactly 10-digit unique phone numbers while preserving leading zeros.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Entering phone number data into a spreadsheet and needing to ensure data accuracy by preventing duplicates and enforcing a strict 10-character limit.
- Observed behavior
- Standard validation rules struggle to simultaneously enforce character count, numeric-only text, and uniqueness, particularly when dealing with leading zeros.
Before applying validation rules, ensure the target column is formatted as Text to prevent Excel from dropping leading zeros from the entered phone numbers.
Apply a Custom Data Validation Formula
Use a combined formula in the Data Validation tool to enforce length, numeric content, and uniqueness all at once.
Phone numbers are best stored as text in Excel to preserve leading zeros. A custom validation formula using AND, LEN, ISNUMBER, and COUNTIF can enforce all three requirements (10 digits, numbers only, no duplicates) simultaneously.
Select the entire column where you will enter phone numbers. Go to the Home tab, click the Number Format dropdown, and select 'Text'.
Keep the column selected, navigate to the Data tab on the ribbon, and click on 'Data Validation'.
In the Settings tab, change the 'Allow' dropdown to 'Custom'. In the Formula box, enter: =AND(LEN(A2)=10,ISNUMBER(--A2),COUNTIF($A:$A,A2)=1). Click OK to apply.

Highlight Existing Duplicates using Conditional Formatting
Identify and clean up duplicate phone numbers that were entered before strict data validation was applied.
Easily Validate Phone Numbers in WPS Spreadsheet
WPS Spreadsheet provides powerful Data Validation and Conditional Formatting tools fully compatible with Microsoft Excel formulas. You can easily enforce 10-digit unique phone number rules to keep your data clean and accurate.
- 1. Format as Text: Open your worksheet in WPS Spreadsheet, select the phone number column, right-click to choose 'Format Cells', and set the category to 'Text'.
- 2. Open Validation Tool: Go to the 'Data' tab on the top ribbon and click on 'Validation'.
- 3. Apply Custom Formula: Choose 'Custom' from the Allow dropdown and input the formula =AND(LEN(A2)=10,ISNUMBER(--A2),COUNTIF($A:$A,A2)=1).
- 4. Confirm Rule: Click 'OK' to apply the rule and immediately prevent incorrect or duplicate phone number entries.

Frequently Asked Questions
Why does Excel remove the leading zero from my phone numbers?
Excel treats numbers with leading zeros as standard integers and automatically removes the zero to save space. To prevent this, format the cells as Text before entering the phone numbers or type an apostrophe (') before the number.
Can I use standard data validation for text length instead of a custom formula?
Yes, you can use the 'Text length' option in Data Validation to ensure exactly 10 characters. However, this built-in option alone cannot simultaneously check for uniqueness and numeric-only characters, which is why a custom formula is highly recommended.
How do I fix validation rules if my data starts in cell B5?
If your selected range starts at B5, adjust your custom validation formula to reference B5 instead of A2. For example, your formula should be: =AND(LEN(B5)=10,ISNUMBER(--B5),COUNTIF($B:$B,B5)=1).
Does data validation apply to pasted data?
By default, standard copy-pasting into Excel can overwrite data validation rules. To maintain the rules while pasting data from another source, use 'Paste Special' and select 'Values' so the destination formatting and validation remain intact.




