Function Problems

Check Whether a Cell Contains Digits in Any Order in Excel

Muhammad TalhaMuhammad Talha Nov 18, 2026 870 views

Question details

Determine whether a cell contains all specified digits, regardless of their order.

Check Whether a Cell Contains Digits in Any Order in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user wants to check whether a cell contains digits such as 1, 2, and 3 in any sequence.
Observed behavior
The desired result is TRUE when all required digits are present and FALSE when any are missing.
Before you start

Identify the cell to check and the digits it must contain. If leading zeros matter, store the value as text so the zeros are retained.

Solution 1Recommended

Use SEARCH and AND to check for all required digits

Check whether a cell contains each digit in a specified set, regardless of order.

1
Select a result cell

Click an empty cell, such as B1, next to the value in A1.

2
Enter the formula

Type =AND(ISNUMBER(SEARCH({1,2,3},A1))) and press Enter. In older Excel versions, you may need to confirm it with Ctrl+Shift+Enter.

3
Check the result

Read the result in B1: TRUE means A1 contains 1, 2, and 3; FALSE means at least one is missing. Values such as 123, 231, and 321 return TRUE.

4
Adjust or copy the formula

Edit {1,2,3} in the formula bar to use other digits, or drag B1's fill handle down to check additional rows.

Use SEARCH and AND to check for all required digits
What the formula checks: The formula checks for the presence of each digit, not an exact match. Extra characters are allowed, and repeated required digits are not counted separately.
Check digits in WPS Spreadsheets

Check for digits in any order with WPS Spreadsheets

Use SEARCH, ISNUMBER, and AND in WPS Spreadsheets to test whether a cell contains all required digits, without depending on their sequence.

  1. 1. Open your spreadsheet: Open WPS Spreadsheets and select Open to load your workbook.
  2. 2. Select a result cell: Click an empty cell such as B1, beside the value in A1.
  3. 3. Enter the formula: Type =AND(ISNUMBER(SEARCH("1",A1)),ISNUMBER(SEARCH("2",A1)),ISNUMBER(SEARCH("3",A1))) and press Enter.
  4. 4. Review and copy the result: Check B1 for TRUE or FALSE, then drag its fill handle down to apply the formula to other rows.
Check required digits in any order with a formulaOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceWork with spreadsheets for free
microsoft office alternative - wps office

Frequently Asked Questions

Will the formula return TRUE if the cell contains extra digits?

Yes. For example, 1234 returns TRUE because it contains 1, 2, and 3. The formula tests for presence, not an exact match.

How do I check for a different set of digits?

Edit the array in the formula bar. For example, =AND(ISNUMBER(SEARCH({4,5,6},A1))) checks whether A1 contains 4, 5, and 6.

Can I use the formula to require two occurrences of the same digit?

No. Repeating a digit in the array does not count its occurrences. Use a separate character-counting formula if the number of occurrences matters.

Why might a leading zero not be found?

Excel removes leading zeros from values stored as numbers. Enter the value as text, for example by typing an apostrophe before it, if the leading zero must be checked.