FACT

Math & Trigonometry Functions
(4.7/5)

Returns the factorial of a number. Factorial (n!) is the product of all positive integers from 1 to n. FACT(n) = n × (n-1) × ... × 2 × 1. Essential for permutations, combinations, probability calculations, and mathematical analysis.

Interactive Formula Tester

=FACT("5")

Complete Theory & Understanding

Master the fundamentals of Excel FACT function

Core Concept

The FACT function returns the factorial of a number. Factorial (n!) is defined as the product of all positive integers from 1 to n: FACT(n) = n × (n-1) × (n-2) × ... × 2 × 1. Special case: FACT(0) = 1 by definition. FACT grows very rapidly: FACT(10) = 3,628,800, FACT(20) ≈ 2.43 × 10^18. If the number is not an integer, it is truncated. Essential for permutations (P(n,r) = n!/(n-r)!), combinations (C(n,r) = n!/(r!(n-r)!)), probability calculations, binomial coefficients, and mathematical analysis.

Why Use FACT?

  • Calculate arrangements
  • Calculate selections
  • Probability calculations
  • Factorial in mathematics

Key Characteristics

Rapid Growth

Grows exponentially

FACT(10) = 3,628,800

Zero Factorial

FACT(0) = 1 (by definition)

Mathematical convention

Truncates Decimals

Uses only integer part

FACT(5.7) = FACT(5) = 120

Non-Negative Only

Negative numbers return error

FACT(-1) = #NUM!

Function Anatomy

=FACT(parameters...)
Required
Parameters:

Function-specific parameters

Returns
Return Value:

Function-specific return type

Primary Use Cases

Permutations

Calculate arrangements

Combinations

Calculate selections

Probability

Probability calculations

Mathematical Analysis

Factorial in mathematics

Theory Summary

Precise

Exact matching required

Position-Based

Returns numeric position

Error-Safe

Handles missing text gracefully

Syntax & Parameters

=FACT(number)
Required
number:

The non-negative number for which you want the factorial. If number is not an integer, it is truncated.

Returns
Return Value:

The factorial of the number

Description: Returns the factorial of a number

Interactive Examples

Basic FACT

Calculate factorial of 5

"5"
=FACT(5)
120

Returns 120 because 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorial grows very quickly.

VBA Implementation & Automation

Basic FACT in VBA

Use FACT function in VBA

' Basic FACT in VBA
Range("C1").Value = Application.WorksheetFunction.Fact(5)
' Returns: 120

' Calculate factorial
Sub CalculateFACT()
    Dim number As Integer
    number = Range("A1").Value
    Dim result As Double
    result = Application.WorksheetFunction.Fact(number)
    Range("B1").Value = result
End Sub

' Calculate permutations: P(n,r) = n!/(n-r)!
Sub CalculatePermutations()
    Dim n As Integer
    Dim r As Integer
    n = Range("A1").Value
    r = Range("A2").Value
    Dim permutations As Double
    permutations = Application.WorksheetFunction.Fact(n) / _
                   Application.WorksheetFunction.Fact(n - r)
    Range("B1").Value = permutations
End Sub

' Calculate combinations: C(n,r) = n!/(r!(n-r)!)
Sub CalculateCombinations()
    Dim n As Integer
    Dim r As Integer
    n = Range("A1").Value
    r = Range("A2").Value
    Dim combinations As Double
    combinations = Application.WorksheetFunction.Fact(n) / _
                   (Application.WorksheetFunction.Fact(r) * _
                    Application.WorksheetFunction.Fact(n - r))
    Range("B1").Value = combinations
End Sub

' Generate factorial table
Sub GenerateFactorialTable()
    Dim i As Integer
    For i = 0 To 10
        Dim factValue As Double
        factValue = Application.WorksheetFunction.Fact(i)
        Range("A" & (i + 1)).Value = i
        Range("B" & (i + 1)).Value = factValue
    Next i
End Sub

Business Applications

Permutations

Calculate arrangements

=FACT(n)/FACT(n-r)

Combinations

Calculate selections

=FACT(n)/(FACT(r)*FACT(n-r))

Probability

Probability calculations

=FACT(total)/FACT(success)

Mathematical Analysis

Factorial in mathematics

=FACT(number)

Common Issues & Solutions

#NUM! Error

FACT returns #NUM! for negative numbers or very large values

=IF(A1>=0, FACT(A1), "Invalid")

Solution: FACT only works with non-negative numbers (≥ 0). FACT of numbers > 170 may overflow. Ensure input is 0 or positive. For very large factorials, consider using approximations (Stirling's approximation).

#VALUE! Error

Non-numeric input in FACT

=FACT(VALUE(A1))

Solution: Ensure input is numeric. FACT requires a number. Check for text, errors, or empty cells. Use VALUE() if needed.

Overflow for Large Numbers

FACT returns error for numbers > 170

For n > 170, consider approximations

Solution: Excel FACT can handle up to FACT(170) ≈ 7.26 × 10^306. Beyond this, use approximations like Stirling's formula or break down the calculation.

Decimal Truncation

FACT truncates decimal part

FACT(5.7) = FACT(5) = 120

Solution: This is expected behavior. FACT(5.7) = FACT(5) = 120. FACT uses only the integer part of the number. Use INT() explicitly if needed.

Performance Tips & Best Practices

⚡ Performance Optimization

  • FACT is fast for small numbers (< 20)
  • For larger numbers, FACT can be slow due to large calculations
  • FACT works efficiently in array formulas for small values
  • Consider caching results for repeated calculations
  • Use approximations (Stirling) for very large numbers

🎯 Best Practices

  • Remember FACT(0) = 1
  • Input must be non-negative (≥ 0)
  • FACT truncates decimal part automatically
  • FACT grows very rapidly - be careful with large inputs
  • Maximum practical value: FACT(170)
  • Test with known values: FACT(5) = 120
  • Use for permutations and combinations
  • Document when using factorial in formulas