Function Problems

Generate Digit Combinations and Permutations in Excel

Tauseeq MagsiTauseeq Magsi Nov 18, 2026 869 views

Question details

The user wants to count and list arrangements of the digits 1, 2, 3, and 4 in a spreadsheet.

How to Generate Digit Combinations and Permutations in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Enter the formula

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))).

2
View the results

Press Enter and leave the cells below the formula empty so the 24 results can spill into them.

3
Check the count

In another cell, enter =PERMUT(4,4) to return 24.

List permutations without repeated digits in Excel
Combinations versus permutations: Order matters in a permutation: 1234 and 4321 are different. COMBIN counts selections where order does not matter; =COMBIN(4,4) returns 1.
WPS Spreadsheets

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. 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. 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. 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. 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.
Generate and filter digit permutations using familiar formulasOpen and save Microsoft Excel XLSX filesCount permutations with the PERMUT functionWork in a familiar spreadsheet interface
microsoft office alternative - wps office

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.