## Permutations with and without repetition

I discussed the difference between permutations and combinations in my last post, today I want to talk about two kinds of permutations, with repetition and without repetition.

### Permutations with repetition

I explained in my last post that phone numbers are permutations because the order is important. But phone numbers may also contain duplicate numbers or repeated numbers like 11 234, here number 1 is repeated. A digit in a phone number has 10 different values, 0 to 9. A five digit phone number has 10x10x10x10x10 or 10^5 equals 100 000 permutations.

Another example with repetitive numbers are bits and bytes. A bit is a single binary number like 0 or 1. A byte is a sequence of bits and eight bits equal one byte. A byte contains 256 different permutations and repetition is allowed.

Here is how you calculate the number of permutations. There are two different values 0 and 1 (binary) and a byte has 8 binary values. 2x2x2x2x2x2x2x2 or 2^8 equals 256 permutations.

**Did you know?** The UTF-8 is a character encoding scheme using 8 bits to encode all possible characters, it is the most used encoding system on world wide web today.

**Constructing a permutations array with binary values**

Excelxor showed us how to build a permutations array using only excel functions, in one of his blog posts.

The picture to the left is an array made by excelxor's formula, this example uses four cells or 4 bits. 2x2x2x2 or 2^4 equals 16 permutations.

With this type of array excelxor finds which numbers add up to a total.

**Array formula:** =MOD(INT(( ROW( INDIRECT("1:"&2^ROWS($A$2:$A$5)))-1 )/2^( TRANSPOSE( ROW( INDIRECT("1:"&ROWS($A$2:$A$5))))-1 )), 2)

I have made a blog post a few years ago how to calculate permutations with repetition with a custom function.

### Permutations without repetition

Imagine constructing an anagram of a word "*police". *You are allowed to rearrange the letters but you can´t repeat a letter. See picture to the right.

Another example is how many times can you rearrange 6 people around a table? Most people will get annoyed if you ask them to change seat more than once but in this example you can rearrange as many times as you like. How many permutations are there? You can´t have a person on two chairs at the same time, repetition is not allowed.

Here is a link to a udf I made a few years ago: Excel udf: List permutations without repetition

**Tip! **Use the PERMUT function to calculate permutations. The word *police* has 6 letters, how many permutations without repetition are there if you choose 6 out of 6 letters?

=PERMUT(6,6) equals 720 permutations.

Question:* I want to learn more about advanced formulas?* I have made an advanced excel course that is available online, check it out.

### Functions in this post

**MOD(***number*, *divisor***)**

The Mod function returns the remainder after a number is divided by divisor.

**INDIRECT(***ref_text*, *[a1]***)**

Returns the reference specified by a text string.

**ROW(**reference**)**

Returns the row number of a reference

### 4 Responses to “Permutations with and without repetition”

### Leave a Reply

**How to add vba code to your comment:**

[vb 1="vbnet" language=","]

your code

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org

Add picture link to comment.

**Contact Oscar**

You can contact me through this webpage

Thank-you for your Combinations formula -- Is there a way to adapt that, or use another function to distribute the resulting combinations "more equitably" over "xx" rows (of dates)? So what am I trying to accomplish? There are six tennis players(players A, B, C, D, E, and F) that share a 15 week contract(actually it's a 32 week contract) to play doubles tennis. I want to set up a schedule to distribute the resulting 15 combinations over a 15 week period that distributes evenly "when" the players play. Using the Combinations function, Player A, "plays" for the first 10 weeks, then is "off" for the next 5 weeks; Player B plays the first six weeks, and then is off for 4 weeks, then plays 4 weeks, then is off the last week; etc. Is there a way to distribute the resulting Combinations such that no player is "off" for more than one or two weeks at a time?

Any thoughts are appreciated.

Is there a way where i can predict all possible outcomes in excel in the below example.

Total games are 13 (ABCDEFGHIJKLM).Possible outcomes are win(home team),draw or win(Away team) represented by 1,X or 2 respectively.Outcomes should be in the below formats

111111111111X

11111111111XX

2222222X22221

222222222222X

Noel,

read this post:

http://www.get-digital-help.com/2016/10/11/list-permutations-with-repetition-and-how-many-to-choose-from/

[…] Noel asks: […]