WorksheetFunction.GammaLn method (Excel)

Returns the natural logarithm of the gamma function, Γ(x).

Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new function, see the GammaLn_Precise method.

Syntax

expression.GammaLn (Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name Required/Optional Data type Description
Arg1 Required Double X - the value for which you want to calculate GammaLn.

Return value

Double

Remarks

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:

Screenshot of the Gamma Ln formula   where   Screenshot of the formula for the Gamma X value

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.