LOGNORM_DIST
Returns the lognormal distribution of x, where ln(x) is normally distributed with the specified parameters.
Syntax
expression.LOGNORM_DIST(arg1, arg2, arg3, arg4);
expression - A variable that represents a ApiWorksheetFunction class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| arg1 | Required | ApiRange | ApiName | number | The value at which to evaluate the function, a positive number. | |
| arg2 | Required | ApiRange | ApiName | number | The mean of ln(x). | |
| arg3 | Required | ApiRange | ApiName | number | The standard deviation of ln(x), a positive number. | |
| arg4 | Required | ApiRange | ApiName | boolean | A logical value (true or false) that determines the function form. If it is true, the function returns the cumulative distribution function. If it is false, the function returns the probability density function. |
Returns
number
Example
Calculate the lognormal probability distribution for a given value in a spreadsheet.
// How do I find the cumulative or probability density for a lognormal distributed variable in a spreadsheet?
// Determine the probability distribution of a lognormally distributed dataset in a spreadsheet.
const worksheet = Api.GetActiveSheet();
//configure function parameters
let numbersArr = [4, 3.5, 1.2];
//set values in cells
for (let i = 0; i < numbersArr.length; i++) {
worksheet.GetRange("A" + (i + 1)).SetValue(numbersArr[i]);
}
//get parameters
let xValue = worksheet.GetRange("A1");
let mean = worksheet.GetRange("A2");
let standardDeviation = worksheet.GetRange("A3");
let cummulative = true;
//invoke LOGNORM.DIST method
let func = Api.WorksheetFunction;
let ans = func.LOGNORM_DIST(xValue, mean, standardDeviation, cummulative);
//print answer
worksheet.GetRange("C1").SetValue(ans);