Check Whether a Cell Contains Digits in Any Order in Excel
Question details
Determine whether a cell contains all specified digits, regardless of their order.

- 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.
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.
Use SEARCH and AND to check for all required digits
Check whether a cell contains each digit in a specified set, regardless of order.
Click an empty cell, such as B1, next to the value in A1.
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.
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.
Edit {1,2,3} in the formula bar to use other digits, or drag B1's fill handle down to check additional rows.

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. Open your spreadsheet: Open WPS Spreadsheets and select Open to load your workbook.
- 2. Select a result cell: Click an empty cell such as B1, beside the value in A1.
- 3. Enter the formula: Type =AND(ISNUMBER(SEARCH("1",A1)),ISNUMBER(SEARCH("2",A1)),ISNUMBER(SEARCH("3",A1))) and press Enter.
- 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.

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.




