The FACT is a math category function in Google Sheets. We can use it to find the factorial of a given number.
We can use factorial (denoted by n!) to find all the possible ways to arrange/order a set of distinct objects. In short, it’s for counting permutations.
For example, we can arrange the letters “X,” “Y,” and “Z” in 6 distinct ways.
It is as follows – “XYZ,” “XZY,” “YXZ,” “YZX,” “ZXY,” and “ZYX.”
The factorial is the product of a certain whole number (n) with all the numbers (non-negative integers) below it, i.e., <=n
.
For example, let’s consider # 3.
3!= 3 x 2 x 1 = 6
We can easily find the factorial of an integer using the FACT function in Google Sheets. Here are the syntax and formula examples.
FACT Function in Google Sheets – Syntax and Argument
Syntax: FACT(value)
Value (parameter 1)- The non-negative number or cell reference for which you want to calculate and return the factorial.
Points to be Noted:
- If the value is not an integer, it is truncated.
- When the value is a reference, and it is blank, the function will add (zero) to it.
- If the value is a text, the formula will return #VALUE!
- When the input value is negative, the FACT function in Google Sheets will return #NUM!
Formula Examples
1. Non-negative number (Hardcoded):
=fact(3)
2. Non-negative number (Cell Reference):
Enter 3 in cell B2 and insert the below FACT formula in cell C2.
=fact(B2)
The FACT Function Array Formula Usage in Google Sheets
We can follow three methods to find the factorial of the numbers 1 to 10 in Google Sheets. Here are them.
Method 1 – Non-Array Formula:
Input the numbers 1 to 10 in an array, for example, in cell range A1:A10.
Use =fact(A1)
in cell B1 and copy it. Paste it down until B10.
Method 2 – Array Formula:
Instead of the copy-paste formula, we can use the below FACT function Array Formula in cell B1.
=ArrayFormula(fact(A1:A10))
Method 3 – Array Formula:
This time, we can use SEQUENCE to generate the numbers 1 to 10 within the formula.
=ArrayFormula(fact(sequence(10,1)))
Here the numbers in A1:A10 are not required. The SEQUENCE takes care of that numbers.
Reverse Factorial in Google Sheets
I don’t have any specific function to find and return reverse factorial in Google Sheets. But I do have a workaround method that you can try.
Please follow the below steps (except for the numbers 0 and 1).
- Enter any factorial in cell A3. For example, insert 3628800 in cell A3, which is the factorial of the number 10.
- Insert the following Vlookup in cell C3
=ifna(vlookup(1,{B3:B,sequence(rows(B3:B),1,2)},2,0))
. - In cell B3, enter
=A3/2
. - In cell B4, enter
=B3/row(A3)
. Copy-paste it down until you get the the number<=1
.
See cell C3 for the output.
That’s all about using the FACT function and finding reverse factorial in Google Sheets.
Thanks for the stay. Enjoy!