GAMMALN Function

Excel Functions › Statistical

All versions Statistical

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.


Quick answer:
=GAMMALN(4) ln(GAMMA(4)) = ln(6) = ~1.7918

Syntax

=GAMMALN(x)
ArgumentDescription
xRequiredA 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:

=GAMMALN(4) // ln(GAMMA(4)) = ln(6) = ~1.7918
=EXP(GAMMALN(4)) // recover GAMMA(4) = 6

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

Live demo

Pick a GAMMALN example to see the formula and its result.

Result:

Practice workbook

📊
Download the free GAMMALN practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

Why use GAMMALN instead of GAMMA?
Because the gamma function grows astronomically — GAMMA of even modest numbers overflows. Working with ln(Γ(x)) keeps the values finite, so it is the standard choice inside log-likelihoods and large factorial calculations.
How do I get the gamma value back from GAMMALN?
Exponentiate it: =EXP(GAMMALN(x)) returns Γ(x). For x=4 that recovers 6, since Γ(4) = 3! = 6.
What is the difference from GAMMALN.PRECISE?
They compute the same quantity. 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?
No — the argument must be strictly positive. Zero or a negative number returns #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

Related functions: GAMMALN.PRECISE · GAMMA · GAMMA.DIST · GAMMA.INV · FACT