The GAMMA function returns the gamma function value for a given number, extending the factorial concept to non-integers. It is useful in statistics, probability, and advanced mathematics directly within Excel.
=GAMMA(number)What does GAMMA do?
The GAMMA function in Excel calculates the gamma function, a mathematical extension of the factorial function. For a positive integer n, GAMMA(n) equals (n-1)!, so GAMMA(5) returns 24. For non-integer numbers, it returns the continuous gamma value, which is essential in many statistical distributions.
This function matters because it lets you compute gamma values without manual lookup tables or complex formulas. It is especially helpful in statistics, engineering, and finance where the gamma function appears in probability density functions, like the gamma and chi-squared distributions.
Imagine you are analysing waiting times in a queue and need to compute probabilities using the gamma distribution. Instead of relying on external tools, you can use GAMMA to get precise values directly in your spreadsheet, making your analysis faster and more transparent.
When to use GAMMA
- Calculating factorials for non-integer values in statistical formulas.
- Computing probability densities for gamma-distributed data.
- Evaluating gamma functions in engineering reliability models.
- Solving combinatorial problems that involve continuous variables.
- Teaching or learning advanced mathematics with Excel.
GAMMA syntax
=GAMMA(number)| Argument | Required? | What to enter |
|---|---|---|
number | Required | The value for which you want the gamma function. It must be a positive number; if it is a negative integer or zero, GAMMA returns an error. Example: 5 or 2.5. |
What it returns: The gamma function value of the given number as a decimal number.
GAMMA examples
1 Example 1: Gamma of a Positive Integer
This example shows the basic use of GAMMA with a positive integer. The formula =GAMMA(B2) computes the gamma value for the number in cell B2, which is 5. Since GAMMA(5) equals 4! = 24, the result is 24. This confirms the relationship between GAMMA and factorials for integers.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Number | Value | |||
| 2 | n | 5 | 24 | ||
| 3 |
2 Example 2: Gamma of a Decimal Number
Here we calculate the gamma function for a non-integer value. The formula =GAMMA(B2) uses the number 2.5 from cell B2. GAMMA(2.5) is approximately 1.329340388, which is returned by Excel. This demonstrates that GAMMA works for decimals, unlike the FACT function.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Number | Value | |||
| 2 | x | 2.5 | 1.329340388 | ||
| 3 |
3 Example 3: Gamma for Multiple Values
This example shows how to apply GAMMA to a list of numbers. The formula =GAMMA(B2) is used in cell D2 to compute the gamma value for the first number, 3. GAMMA(3) equals 2! = 2. You can copy the formula down for other rows. The result for the first row is 2.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | ID | Number | |||
| 2 | 1 | 3 | 2 | ||
| 3 | 2 | 4 | |||
| 4 | 3 | 5 | |||
| 5 |
4 Example 4: Gamma in Probability Calculation
In this realistic business scenario, we compute the gamma function for a parameter used in a gamma distribution. The formula =GAMMA(B2) calculates GAMMA(1.5), which is approximately 0.886226925. This value might be used as a normalizing constant in a probability density function. The result is 0.886226925.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Parameter | Value | |||
| 2 | Shape | 1.5 | 0.8862269255 | ||
| 3 |
5 Example 5: Gamma for Factorial of Non-Integer
This example highlights how GAMMA extends factorial to non-integers. The formula =GAMMA(B2) computes GAMMA(4.5), which is approximately 11.6317284. This is useful when you need a factorial-like value for a decimal, such as in advanced statistical models. The returned value is 11.6317284.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Number | Value | |||
| 2 | x | 4.5 | 11.6317284 | ||
| 3 |
Common GAMMA errors and how to fix them
| Error | Why it happens | How to fix it |
|---|---|---|
| #NUM! | The number argument is zero or a negative integer, for which the gamma function is undefined. | Ensure the number is positive and not a negative integer. Use a value greater than zero. |
| #VALUE! | The number argument is non-numeric, such as text. | Provide a numeric value or a reference to a cell containing a number. |
| #NAME? | The function name is misspelled, or the GAMMA function is not available in your Excel version (pre-2013). | Check the spelling and ensure you are using Excel 2013 or later. |
Tips for using GAMMA
- Use GAMMA to compute factorials for non-integers; for integers, FACT is simpler.
- Remember that GAMMA(n) = (n-1)! for positive integers.
- Combine GAMMA with other statistical functions like GAMMADIST for probability calculations.
- Avoid using GAMMA with zero or negative integers to prevent errors.
- For very large numbers, GAMMA may return #NUM! due to overflow; consider using GAMMALN instead.
Frequently asked questions
What is the difference between GAMMA and FACT?
GAMMA works for any positive number, while FACT only works for non-negative integers. For an integer n, GAMMA(n) equals FACT(n-1).
Can GAMMA handle negative numbers?
GAMMA returns #NUM! for zero and negative integers. For negative non-integers, it may return a value, but Excel's GAMMA function only accepts positive numbers; it returns #NUM! for any negative number.
Is GAMMA available in Excel 2010?
No, GAMMA was introduced in Excel 2013. It is available in Excel 2013 and all later versions, including Microsoft 365.
Related functions
Every example on this page was recalculated by SheetSkill’s spreadsheet engine. GAMMA reference