Generate Digit Combinations and Permutations in Excel
Question details
The user wants to count and list arrangements of the digits 1, 2, 3, and 4 in a spreadsheet.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Generate four-digit sequences and determine whether repeated digits should be allowed.
- Observed behavior
- The desired output may be permutations without repetition or sequences that allow repeated digits; the rule needs clarification.
Decide whether each digit can appear more than once and whether order matters. The examples below use four positions and the digits 1 through 4.
List permutations without repeated digits in Excel
Use a dynamic-array formula to list all 24 arrangements when each digit must appear exactly once.
This formula requires an Excel version that supports LET, SEQUENCE, and FILTER. It generates possible sequences and keeps only those with four distinct digits.
Select an empty cell and enter =LET(n,SEQUENCE(256,,0),a,QUOTIENT(n,64)+1,b,MOD(QUOTIENT(n,16),4)+1,c,MOD(QUOTIENT(n,4),4)+1,d,MOD(n,4)+1,FILTER(1000*a+100*b+10*c+d,(a<>b)*(a<>c)*(a<>d)*(b<>c)*(b<>d)*(c<>d))).
Press Enter and leave the cells below the formula empty so the 24 results can spill into them.
In another cell, enter =PERMUT(4,4) to return 24.

List four-digit sequences that allow repetition
Use this method when digits can appear in more than one position, producing 256 sequences.
Generate digit permutations in WPS Spreadsheets
Use standard spreadsheet formulas and a filter in WPS Spreadsheets to list four-digit arrangements without repeated digits.
- 1. Set up the rows: Open WPS Spreadsheets and create a blank workbook. Enter headers Index, Digit 1, Digit 2, Digit 3, Digit 4, Sequence, and Unique in cells A1:G1. Enter =ROW()-2 in A2 and fill it down through A257.
- 2. Calculate the digits: Enter =QUOTIENT(A2,64)+1 in B2, =MOD(QUOTIENT(A2,16),4)+1 in C2, =MOD(QUOTIENT(A2,4),4)+1 in D2, and =MOD(A2,4)+1 in E2. Select B2:E2 and fill down through row 257.
- 3. Build and test each sequence: Enter =B2*1000+C2*100+D2*10+E2 in F2. Enter =IF(AND(B2<>C2,B2<>D2,B2<>E2,C2<>D2,C2<>E2,D2<>E2),"Yes","No") in G2, then fill F2:G2 down through row 257.
- 4. Filter the results: Select A1:G257, choose Data > Filter, and filter the Unique column to Yes. Column F then shows the 24 permutations; select both Yes and No to see all 256 sequences.

Frequently Asked Questions
How many arrangements can I make from 1, 2, 3, and 4 without repetition?
There are 24 arrangements. Enter =PERMUT(4,4) in Excel or WPS Spreadsheets to calculate the count.
How many four-digit sequences are possible if digits can repeat?
There are 256 sequences because each of the four positions has four choices. Enter =4^4 in a spreadsheet cell to calculate the total.
Does COMBIN list the digit arrangements?
No. COMBIN returns a count of selections where order does not matter. For example, =COMBIN(4,4) returns 1; use a listing formula or helper columns to display arrangements.
Why does the Excel formula show a spill error?
The dynamic-array formula needs empty cells below it for its results. Clear any content blocking the output range and press Enter again.




