The Excel Gammaln function returns the natural logarithm of the Gamma Function, Γ(n).
Syntax:= GAMMALN(x)
The GAMMALN function syntax has the following arguments:
 X: Required. The value for which you want to calculate GAMMALN.
Example: Let’s look at some Excel GAMMALN function examples and explore how to use the GAMMALN function as a worksheet function in Microsoft Excel:
Syntax: =GAMMALN(A2)
Result: 10.6046029
Based on the Excel spreadsheet above, the following GAMMALN examples would return:
Syntax: =GAMMALN(A3)
Result: 9.03318692
Syntax: =GAMMALN(A4)
Result: 54.7847294
Syntax: =GAMMALN(A5)
Result: #NUM!
Syntax: =GAMMALN(A6)
Result: #NUM!
Syntax: =GAMMALN(A7)
Result: 1.791759469
Syntax: =GAMMALN(A8)
Result: 0.28468287
Syntax: =GAMMALN(A9)
Result: 4.787491743
Syntax: =GAMMALN(A10)
Result: 3.639636069
Note:
 If x is nonnumeric, GAMMALN returns the #VALUE! error value.
 If x ≤ 0, GAMMALN returns the #NUM! error value.
 The number e raised to the GAMMALN(i) power, where i is an integer, returns the same result as (i – 1)!.

GAMMALN is calculated as follows:
where: