Google Sheets does not have a built-in FACT function that returns the factorial of a number in a single step, but you can get the same result reliably using a short formula. The standard workaround is to use the FACT function if your spreadsheet locale or add-on exposes it, or to calculate factorials with a simple multiplication chain or a custom formula. In practice, most users should use =FACT(n) where available, and otherwise build the factorial manually with PRODUCT and SEQUENCE. This guide shows the exact steps, the common errors, and how to handle large numbers safely.
What You'll Need
- A Google account with access to Google Sheets (desktop browser or the mobile app).
- A spreadsheet open and edit permission on the file.
- Basic familiarity with entering formulas starting with
=. - For large factorials, awareness that Sheets calculates with floating-point numbers and very large results lose precision.
Step-by-Step
- Open your spreadsheet. In a desktop browser, go to Google Sheets and open the file where you want the result. On mobile, open the Sheets app and the same file. Menu labels can differ slightly by version, device, or region.
- Pick an empty cell. Click or tap a cell such as A1 or B2 where the factorial result should appear.
- Enter the FACT formula. Type
=FACT(5)and press Enter. If your Sheets version supports the function, the cell returns 120. Replace 5 with a cell reference such as=FACT(A1)to calculate from a number you type elsewhere. - If FACT is not recognised, use PRODUCT with SEQUENCE. Type
=PRODUCT(SEQUENCE(A1))where A1 contains a positive whole number. For example, with 5 in A1, this returns 120.SEQUENCE(5)produces 1,2,3,4,5 andPRODUCTmultiplies them. - Or build a manual multiplication chain. For small numbers, type
=1*2*3*4*5to get 120. This is the most transparent method and works in every version of Sheets. - Test with 0 and 1. By mathematical convention, 0! = 1 and 1! = 1. Check that your formula returns 1 for both.
=FACT(0)should return 1;=PRODUCT(SEQUENCE(0))may error because SEQUENCE needs a positive size, so use an IF wrapper if you need to handle zero:=IF(A1=0,1,PRODUCT(SEQUENCE(A1))). - Copy the formula down. Drag the fill handle (the small square at the bottom-right of the selected cell) down the column to apply the formula to a list of numbers. On mobile, use the autofill suggestion that appears when you select the cell.
- Format the result. Select the result cells and use Format > Number to choose plain number or scientific notation if the values are very large.
- Check for errors. If you see
#NUM!, the input is likely negative or too large. If you see#VALUE!, the cell contains text instead of a number. Correct the input and the formula recalculates.
Common Mistakes
- Assuming FACT always exists. Some Sheets builds and locales do not expose the function, so the PRODUCT/SEQUENCE method is the safer default.
- Using negative numbers. Factorials are defined for non-negative integers only. A negative input returns an error.
- Forgetting that 0! = 1. A plain
PRODUCT(SEQUENCE(0))errors, so wrap it in an IF statement if zero is a possible input. - Expecting exact results for large numbers. Sheets stores numbers as floating-point values, so factorials above roughly 20 lose precision and display in scientific notation.
- Typing text instead of numbers. A cell containing "5 " with a trailing space is text, not a number, and will trigger
#VALUE!. - Dragging the formula without locking references. If you reference a fixed cell, use
$A$1so the reference does not shift when copied.
Tips
- Use
=FACT(A1)when it works; it is shorter and easier to read than the PRODUCT/SEQUENCE version. - For a quick check, 10! = 3,628,800. If your formula returns that, it is working correctly.
- Combine with
IFERRORto hide errors:=IFERROR(FACT(A1),"check input"). - Keep input cells formatted as numbers (Format > Number > Number) to avoid text-entry problems.
- For teaching or auditing, the manual chain
=1*2*3*4*5shows exactly how the result is built.
Troubleshooting
If the formula returns an error, work through these checks in order:
- Confirm the input is a non-negative whole number. Select the input cell and check the value in the formula bar. Remove spaces or text.
- Check the function name. In Sheets, function names are not case-sensitive, but a typo such as
FACorFACTORIALwill produce#NAME?. UseFACTexactly. - Try the alternative method. If
=FACT(5)returns#NAME?, switch to=PRODUCT(SEQUENCE(5)). - Recalculate. Press Ctrl+R (Windows) or Cmd+R (Mac) to force a recalculation, or reload the page.
- Check for protected cells. If the cell is locked, the formula may not save. Ask the file owner for edit access.
- Test in a new sheet. Create a blank spreadsheet and enter
=FACT(5). If it works there, the issue is in the original file's data or formatting.
If none of that works, the function may not be available in your account or locale. Use the manual multiplication chain for small numbers, or a custom Apps Script function for larger ones. Creating a custom function requires script editor access and is not necessary for most users.
Frequently Asked Questions
Does Google Sheets have a FACT function?
Some versions and locales expose FACT, but it is not universally available. The reliable alternative is =PRODUCT(SEQUENCE(n)) or a manual multiplication chain.
What is 0 factorial in Sheets?
By convention, 0! = 1. =FACT(0) returns 1. The SEQUENCE method needs an IF wrapper because SEQUENCE(0) errors.
Why does my factorial show scientific notation?
Sheets uses floating-point numbers, so very large factorials exceed exact precision and display in scientific notation. This is expected, not an error.
Can I calculate factorials for a whole column at once?
Yes. Put your numbers in column A, enter the formula in B1, and drag the fill handle down. Use $A$1 style references if you need a fixed cell.
What is the largest factorial Sheets can calculate accurately?
Exact integer precision holds up to about 20!. Beyond that, results are approximate. If you need exact large factorials, use a dedicated math tool rather than Sheets.
Why do I get #VALUE! instead of a number?
The input cell likely contains text, a space, or a non-numeric character. Reformat the cell as a number and re-enter the value.