The Excel GAMMALN function returns the natural logarithm of the gamma function, ln(Γ(x)) — the safe way to work with gamma values that would otherwise overflow as huge numbers.
Syntax
| Argument | Description | |
|---|---|---|
x | Required | A positive number at which to evaluate ln(Γ(x)). Must be > 0. |
How to use it
For large arguments the gamma function explodes far beyond what a cell can hold — Γ(200) has over 370 digits. Taking its logarithm keeps the numbers manageable, which is exactly what GAMMALN does:
It is the building block of log-likelihoods and combinatorial formulas in statistics, where you add logs instead of multiplying enormous factorials. To get the gamma value itself back, exponentiate with EXP.
GAMMALN vs GAMMALN.PRECISE: they return the same result. GAMMALN.PRECISE (Excel 2013+) uses a more accurate algorithm and is preferred in new workbooks; GAMMALN exists in every version for compatibility.
Try it: interactive demo
Pick a GAMMALN example to see the formula and its result.
Practice workbook
Frequently asked questions
Why use GAMMALN instead of GAMMA?
How do I get the gamma value back from GAMMALN?
=EXP(GAMMALN(x)) returns Γ(x). For x=4 that recovers 6, since Γ(4) = 3! = 6.What is the difference from GAMMALN.PRECISE?
GAMMALN.PRECISE (Excel 2013+) uses a higher-accuracy algorithm and is the recommended modern function; plain GAMMALN is kept for backward compatibility.Does GAMMALN accept zero or negatives?
#NUM!.Master functions like this in one day
This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class