# How to use the FACT function

**What is the FACT function?**

The FACT function returns the factorial of a number.

#### Table of Contents

## 1. Introduction

**What is the factorial of a number?**

The factorial of a number n is the product of all positive integers less than or equal to n, and is represented by n!

The factorial of a number n is defined as:

n! = n * (n-1) * (n-2) * ... * 3 * 2 * 1

In other words, the factorial of a number n is the product of all positive integers less than or equal to n.

Some examples:

1! = 1

2! = 2 * 1 = 2

3! = 3 * 2 * 1 = 6

4! = 4 * 3 * 2 * 1 = 24

5! = 5 * 4 * 3 * 2 * 1 = 120

0! = 1

The factorial function grows very quickly as n increases. Factorials are useful in combinatorics for counting permutations and combinations.

**How to calculate combinations using factorials?**

The formula for combinations is:

C(n, r) = n! / (r! * (n-r)!)

Where:

n = Total number of objects

r = Size of the subset we choose

For example, say we have 5 fruits: apple, banana, orange, mango and peach. We want to calculate how many combinations of 3 fruits there are from this set of 5 fruits.

n = 5 (total fruits) r = 3 (size of subset)

C(5, 3) = 5! / (3! * (5-3)!) = 120 / (6 * 2) = 10

**How to calculate permutations using factorials?**

For example, ordering 3 letters out of the alphabet.

The formula for permutations is:

P(n, r) = n! / (n - r)!

Where:

n = Total number of objects

r = Number of objects being arranged

For example, say we want to find how many ways we can arrange 3 letters from the alphabet.

n = 26 (total letters) r = 3 (letters we are arranging)

P(26, 3) = 26! / (26 - 3)! = 26! / 23! = 15600

**What are permutations?**

A permutation is a way of arranging a set of elements in a specific order. For example, if you have three letters A, B, and C, you can arrange them in six different ways: ABC, ACB, BAC, BCA, CAB, and CBA.

Each of these arrangements is called a permutation of the three letters. The order of the objects matters in a permutation, so ABC and BAC are considered different permutations.

The PERMUT and PERMUTATIONA functions are in the Statistical category

**What are combinations?**

A combination is a way of selecting items from a collection where the order of selection does not matter.

For example, if you have three fruits, say an apple, an orange, and a pear. There are three combinations of two that can be drawn from this set:

- apple and a pear
- apple and an orange
- pear and an orange

The COMBIN and COMBINA functions are in the Math and trigonometry category.

## 2. Syntax

FACT(*number*)

number |
Required. The number equal to or larger than 0 (zero) for which you want to calculate the factorial. |

If *number* is not an integer, it is truncated.

Returns an error if the *number *argument is a text value.

## 3. Example 1

This example shows how to use the FACT function, the arguments are in cell range B3:B7 and the results are in C3:C7. Cell range D3:D7 shows the calculations in detail.

Formula in cell C3:

- The factorial of number 0 (zero) is 1. The factorial n! is defined as the product of all positive integers less than or equal to n. By this definition, 0! should be the product of no numbers which is typically considered to be 1 (the empty product)
- The factorial of number 1 is also 1. 1! = 1
- The factorial of number 2 is 2. 2! = 2*1
- The factorial of number 3 is 6. 3! = 3*2*1

The FACT function is useful if you want to calculate the number of permutations of a given set of elements.

The following set has three elements: [A, B, C].

3! = 3*2*1 = 6. You can rearrange [A, B, C] in six different permutations.

1, [A, B, C]

2, [A, C, B]

3, [B, A, C]

4, [B, C, A]

5, [C, A, B]

6, [C, B, A]

## 4. Example 2

**How many permutations are there in this data set: [A, B, C, and D] if three items can be selected? Repetition is not allowed.**

The number of permutations of a set of n distinct items, taken r at a time, is given by the formula:

nPr = n! / (n - r)!

n! - (read as "n factorial") represents the product of all positive integers less than or equal to n

(n - r)! - represents the product of all positive integers less than or equal to (n - r)

Formula in cell C6:

The formula returns 24, lets calculate this value manually:

For example, if we want to find the number of permutations of 4 items taken 3 at a time, we would calculate:

4P3 = 4! / (4 - 3)!

=(4 * 3 * 2 * 1) / 1

=24 / 1

=24

So, there are 24 possible permutations of 4 items taken 3 at a time.

## 5. Example 3

**How many combinations are there in this data set: [A, B, C, and D] if three items can be selected? Repetition is not allowed.
**

The math formula to calculate the number of combinations is:

C(n,r) = n!/(r!(n-r)!)

- C = Combinations
- n = objects (number)
- r = sample (number_chosen)

The arguments are in cells C2: and C3:

- C2: 4 (objects)
- C3: 3 (sample)

Formula in cell C6:

Here is how the formula is calculated in greater detail:

C(n,r) = n!/(r!(n-r)!)

=4!/(3!*(4-3)!)

=24/(6*1)

=4

The result is 4 combinations based on 4 objects in total and 3 numbers chosen. This value matches the calculated value in cell C6.

## 6. Example 4

**How many combinations are there in this data set: [A, B, C, and D] if three items can be selected? ****Repetition is allowed.**

The math formula to calculate the number of combinations (repetition allowed) is:

nCr (with repetition) = (n+r-1)! / (r! * (n-1)!)

- n is the total number of items
- r is the number of items being chosen

The arguments are in cells C2: and C3:

- C2: 4 (objects)
- C3: 3 (sample)

Formula in cell C6:

Here is how the formula is calculated in greater detail:

nCr (with repetition) = (n+r-1)! / (r! * (n-1)!)

=(4+3-1)!/(3!*(4-1)!)

=6*5*4*3*2*1/(3*2*1*(3*2*1))

=720/(6*6)

=720/36

=20

The calculated value is 20 which matches the calculated value in cell C6.

### 'FACT' function examples

I discussed the difference between permutations and combinations in my last post, today I want to talk about two kinds […]

This article demonstrates a macro that lets you create a list of permutations, repetitions are allowed, based on a number […]

Today I have two functions I would like to demonstrate, they calculate all possible combinations from a cell range. What […]

### Functions in 'Math and trigonometry' category

The FACT function function is one of 61 functions in the 'Math and trigonometry' category.

## How to comment

How to add a formula to your comment<code>Insert your formula here.</code>

Convert less than and larger than signsUse html character entities instead of less than and larger than signs.

< becomes < and > becomes >

How to add VBA code to your comment[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

How to add a picture to your comment:Upload picture to postimage.org or imgur

Paste image link to your comment.

Contact OscarYou can contact me through this contact form