Returns statistics that describe an exponential curve matching known data points.
Name | Type | Description |
arg1 | ApiRange | The set of y-values from the y = b*m^x equation. |
arg2 | ApiRange | An optional set of x-values from the y = b*m^x equation. |
arg3 | boolean | A logical value: the constant b is calculated normally if this parameter is set to true or omitted, and b is set equal to 1 if the parameter is false. |
arg4 | boolean | A logical value: return additional regression statistics if this parameter is set to true, and return m-coefficients and the constant b if the parameter is false or omitted. |
builder.CreateFile("xlsx"); const oWorksheet = Api.GetActiveSheet(); //configure function parameters var yValues = [1500, 1230, 1700, 1000, 980, 1470, 1560, 1640, 1420, 1100]; var xValues = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; var constant = true; var stats = false; //set values in cells for (var i = 0; i < yValues.length; i++) { oWorksheet.GetRange("A" + (i + 1)).SetValue(yValues[i]); } for (var i = 0; i < xValues.length; i++) { oWorksheet.GetRange("B" + (i + 1)).SetValue(xValues[i]); } //get x and y ranges var yRange = oWorksheet.GetRange("A1:A10"); var xRange = oWorksheet.GetRange("B1:B10"); var oFunction = Api.GetWorksheetFunction(); //invoke LOGEST method var ans = oFunction.LOGEST(yRange, xRange, constant, stats); //print answer oWorksheet.GetRange("D1").SetValue(ans); builder.SaveFile("xlsx", "LOGEST.xlsx"); builder.CloseFile();