ToolGood.Algorithm is a powerful, lightweight, Excel formula
compatible algorithm library aimed at improving developers’ productivity in different business scenes.
Applicable scenarios: Code and algorithm are separated to avoid forced project upgrade
1)Uncertain algorithm at the beginning of the project;
2)Algorithms that are frequently changed during project maintenance;
3)Algorithms in financial data and statistical data (Note: Some formulas use the double
type, and it is recommended to use fen
as the unit);
4)The report is exported, the data source uses the stored procedure, and the algorithm is set in the Word document. Example https://github.com/toolgood/ToolGood.WordTemplate
5)Rule engines, such as: https://github.com/toolgood/ToolGood.FlowVision
AlgorithmEngine engine = new AlgorithmEngine();
double a=0.0;
if (engine.Parse("1+2")) {
var o = engine.Evaluate();
a=o.NumberValue;
}
var b = engine.TryEvaluate("1=1 && 1<2 and 7-8>1", 0);// Support(支持) && || and or
var c = engine.TryEvaluate("2+3", 0);
var q = engine.TryEvaluate("-7 < -2 ?1 : 2", 0);
var e = engine.TryEvaluate("count(array(1, 2, 3, 4))", 0);//{} represents array, return: 4 {}代表数组, 返回:4
var s = engine.TryEvaluate("'aa'&'bb'", ""); //String connection, return: AABB 字符串连接, 返回:aabb
var r = engine.TryEvaluate("(1=1)*9+2", 0); //Return: 11 返回:11
var d = engine.TryEvaluate("'2016-1-1'+1", DateTime.MinValue); //Return date: 2016-1-2 返回日期:2016-1-2
var t = engine.TryEvaluate("'2016-1-1'+9*'1:0'", DateTime.MinValue);//Return datetime:2016-1-1 9:0 返回日期:2016-1-1 9:0
var j = engine.TryEvaluate("json('{\"Name\":\"William Shakespeare\", \"Age\":51, \"Birthday\":\"04/26/1564 00:00:00\"}').Age", null);//Return 51 返回51
var k = engine.TryEvaluate("json('{\"Name\":\"William Shakespeare \", \"Age\":51, \"Birthday\":\"04/26/1564 00:00:00\"}')[Name].Trim()", null);//Return to "William Shakespeare" 返回"William Shakespeare" (不带空格)
var l = engine.TryEvaluate("json('{\"Name1\":\"William Shakespeare \", \"Age\":51, \"Birthday\":\"04/26/1564 00:00:00\"}')['Name'& 1].Trim().substring(2, 3)", null); ;//Return "ill" 返回"ill"
var n = engine.TryEvaluate("{Name:\"William Shakespeare\", Age:51, Birthday:\"04/26/1564 00:00:00\"}.Age", null);//Return 51 返回51
var m = engine.TryEvaluate("{1,2,3,4,5,6}.has(13)", true);//Return false 返回false
Constantspi
, e
, true
, false
are supported.
The value is converted to bool, non-zero is true and zero is false.
String to bool, 0
andFALSE
is false, 1
andTRUE
is true. Case insensitive.
Bool to value, false is0
, true is1
.
Bool to string, false toFALSE
, true toTRUE
.
The default index isexcel index
. If you want to use c# index, please setUseExcelIndex
tofalse
.
Chinese symbols are automatically converted into English symbols: brackets
, commas
, quotation marks
, double quotation marks
,addition
,subtraction
, multiplication
, division
, equal sign
.
Note: Use &
for string concatenation.
Note: find
is an Excel formula , find (the string to be searched, the string to be searched [, start position])
//Define cylinder information 定义圆柱信息
public class Cylinder : AlgorithmEngine
{
private int _radius;
private int _height;
public Cylinder(int radius, int height)
{
_radius = radius;
_height = height;
}
protected override Operand GetParameter(string parameter)
{
if (parameter == "半径")
{
return Operand.Create(_radius);
}
if (parameter == "直径")
{
return Operand.Create(_radius * 2);
}
if (parameter == "高")
{
return Operand.Create(_height);
}
return base.GetParameter(parameter);
}
}
//Call method 调用方法
Cylinder c = new Cylinder(3, 10);
c.TryEvaluate("[半径]*[半径]*pi()", 0.0); //Round bottom area 圆底面积
c.TryEvaluate("[直径]*pi()", 0.0); //The length of the circle 圆的长
c.TryEvaluate("[半径]*[半径]*pi()*[高]", 0.0); //Volume of circle 圆的体积
c.TryEvaluate("['半径']*[半径]*pi()*[高]", 0.0); //Volume of circle 圆的体积
c.EvaluateFormula("'圆'-[半径]-高", '-'); // Return: 圆-3-10
c.GetSimplifiedFormula("半径*if(半径>2, 1+4, 3)"); // Return: 3 * 5
Parameter definitions, such as[parameter name]
, 【parameter name】
, #parameter name#
, @parameterName
.
Note: You can also use AddParameter
, AddParameterFromJson
to add methods, and use DiyFunction
+= to customize functions.
Note 2: use AlgorithmEngineHelper.GetDiyNames
get parameter name
and custom function name
.
var helper = new ToolGood.Algorithm.AlgorithmEngineHelper();
helper.IsKeywords("false"); // return true
helper.IsKeywords("true"); // return true
helper.IsKeywords("mysql"); // return false
DiyNameInfo p5 = helper.GetDiyNames("ddd(d1, 22)");
Assert.AreEqual("ddd", p5.Functions[0]);
Assert.AreEqual("d1", p5.Parameters[0]);
Standard units can be set: DistanceUnit
(default:m
), AreaUnit
(default:m2
), VolumeUnit
(default:m3
), MassUnit
(default:kg
).
Note: When calculating the formula, first convert the quantity with units into standard units, and then perform numerical calculations.
AlgorithmEngine engine = new AlgorithmEngine();
bool a = engine.TryEvaluate("1=1m", false); // return true
bool b = engine.TryEvaluate("1=1m2", false); // return true
bool c = engine.TryEvaluate("1=1m3", false); // return true
bool d = engine.TryEvaluate("1=1kg", false); // return true
// Unit Conversion 单位转化
var num = AlgorithmEngineHelper.UnitConversion(1M,"米","千米");
// Example of not throwing mistakes 不抛错例子
bool error = engine.TryEvaluate("1m=1m2", false); // return true
Functions: logical functions
, mathematics and trigonometric functions
, text functions
, statistical functions
, date and time functions
Note: Function names are not case sensitive. Parameters with square brackets can be omitted. The return value of the example is approximate.
Note 2: The function name with ★ indicates that the first parameter can be prefixed, such as (-1).ISTEXT()
Note 3: The function name with ▲ means that it is affected by Excel Index
,
function name | description | Example |
IF | if(condition, trueValue[, falseValue]) Execute the judgment and return different results according to the true or false of the logical calculation. |
if(1=1, 1, 2) >>1 |
ifError | ifError(condition, trueValue[, falseValue]) If the formula calculates incorrectly, the value you specify is returned; otherwise, the formula result is returned. |
ifError(1/0, 1, 2) >>1 |
isError ★ |
isError(value) To determine whether there is an error, return TRUE or FALSE isError(value, replace) If there is an error, return the replacement value, otherwise return the original value |
isError(1) >>false |
isNull ★ |
isNull(value) Determine whether it is null or return TRUE or FALSE isNull(value, replace) If null, return the replacement value, otherwise return the original value |
isNull(null) >>true |
isNullOrError ★ |
isNullOrError(value) To determine whether it is null or error, return TRUE or FALSE isNullOrError(value, replace) If it is null or wrong, return the replacement value, otherwise return the original value |
isNullOrError(null) >>true |
isNumber ★ | isNumber(value) Determine whether it is a numeric value, and return TRUE or FALSE |
isNumber(1) >>true |
isText ★ | isText(value) Determine whether it is a text and return TRUE or FALSE |
isText('1') >>true |
IsNonText ★ | IsNonText(value) Determine whether it is not a text and return TRUE or FALSE |
IsNonText('1') >>false |
IsLogical ★ | IsLogical(value) Determine whether it is a logical value and return TRUE or FALSE |
IsLogical('1') >>false |
IsEven ★ | IsEven(value) If the value is even, return TRUE or FALSE |
IsEven('1') >>false |
IsOdd ★ | IsOdd(value) If the value is odd, return TRUE or FALSE |
IsOdd('1') >>true |
AND | and(logic1, ...) If all parameters are true, return true. If there is an error, report it first |
and(1, 2=2) >>true |
OR | or(logic1, ...) If any parameter is TRUE, return TRUE. If there is an error, report it first |
or(1, 2=3) >>true |
NOT | not(logic) Negate the logical value of a parameter |
NOT(true()) >>false |
TRUE | true() Return TRUE |
true() >>true |
FALSE | false() Return FALSE |
false() >>false |
classification | function name | description | Example |
basic mathematics | E | e() Return e value |
E() >> |
PI | pi() Return PI value |
pi() >>3.141592654 |
|
abs | abs(number) Returns the absolute value of a numerical value |
abs(-1) >>1 |
|
QUOTIENT | quotient(number, dividend) Returns the integer portion of the quotient, which can be used to round off the fractional portion of the quotient. |
QUOTIENT(7, 3) >>2 |
|
mod | mod(number, dividend) Returns the remainder of the division of two numbers |
MOD(7, 3) >>1 |
|
SIGN | sign(number) Returns the sign of a numerical value. Returns 1 when the value is positive, 0 when it is zero, and -1 when it is negative. |
SIGN(-9) >>-1 |
|
SQRT | sqrt(number) Returns the positive square root |
SQRT(9) >>3 |
|
TRUNC | trunc(number) Truncate the value |
TRUNC(9.222) >>9 |
|
int ★ | int(number) Rounds the value down to the nearest integer. |
int(9.222) >>9 |
|
gcd | gcd(number, ...) Returns the maximum common divisor |
GCD(3, 5, 7) >>1 |
|
LCM | lcm(number, ...) Returns the least common multiple of an integer parameter |
LCM(3, 5, 7) >>105 |
|
combin | combin(tatal, number) Calculate the number of combinations to extract several objects from a given number of object sets |
combin(10, 2) >>45 |
|
PERMUT | permut(tatal, number) Returns the ranking of several objects selected from a given number of object collections |
PERMUT(10, 2) >>990 |
|
FIXED | fixed(number[, decimalDigit[, hasComma]]) Format numeric values to text with fixed decimal places |
FIXED(4567.89, 1) >>4, 567.9 |
|
Triangulation function | degrees | degrees(radian) Convert radians to degrees |
degrees(pi()) >>180 |
RADIANS | radians(degree) Convert degrees to radians |
RADIANS(180) >>3.141592654 |
|
cos | cos(radian) Returns the cosine of a numerical value |
cos(1) >>0.540302305868 |
|
cosh | cosh(radian) Returns the hyperbolic cosine of a value |
cosh(1) >>1.54308063481 |
|
SIN | sin(radian) Returns the sine of a given angle |
sin(1) >>0.84147098480 |
|
SINH | sinh(radian) Returns the hyperbolic sine of a numeric value |
sinh(1) >>1.1752011936 |
|
TAN | tan(radian) Returns the tangent of a numerical value |
tan(1) >>1.55740772465 |
|
TANH | tanh(radian) Returns the hyperbolic tangent of a value |
tanh(1) >>0.761594155955 |
|
acos | acos(number) Returns the inverse cosine of a numeric value |
acos(0.5) >>1.04719755119 |
|
acosh | acosh(number) Returns the inverse hyperbolic cosine of a value |
acosh(1.5) >>0.962423650119 |
|
asin | asin(number) Returns the arcsine of a value |
asin(0.5) >>0.523598775598 |
|
asinh | asinh(number) Returns the inverse hyperbolic sine of a value. |
asinh(1.5) >>1.1947632172 |
|
atan | atan(number) Returns the inverse tangent of a value |
atan(1) >>0.785398163397 |
|
atanh | atanh(number) Returns the inverse hyperbolic tangent of the parameter |
atanh(1) >>0.549306144334 |
|
atan2 | atan2(number, number) Return anti-tangent from X and Y coordinates |
atan2(1, 2) >>1.10714871779 |
|
Round off | ROUND | round(number, decimalDigit) Returns the value of a value rounded by the specified number of digits. |
ROUND(4.333, 2) >>4.33 |
roundDown | roundDown(number, decimalDigit) Close to zero, rounding the value down (the direction in which the absolute value decreases). |
roundDown(4.333, 2) >>4.33 |
|
roundUp | roundUp(number, decimalDigit) Away from zero, round the value upward (the direction in which the absolute value increases). |
roundUp(4.333, 2) >>4.34 |
|
CEILING | ceiling(number, roundingBase) Rounding up (in the direction in which the absolute value increases) is a multiple of the nearest rounding base. |
CEILING(4.333, 0.1) >>4.4 |
|
floor | floor(number, roundingBase) Round down to a multiple of the nearest Significance. |
FLOOR(4.333, 0.1) >>4.3 |
|
even | even(number) Returns the nearest even number rounded in the direction of increasing the absolute value. |
EVEN(3) >>4 |
|
ODD | odd(number) Rounds the value up to the nearest odd integer |
ODD(3.1) >>5 |
|
MROUND | mround(number, roundingBase) Returns a value rounded to the desired multiple |
MROUND(13, 5) >>15 |
|
Random number | RAND | rand() Returns a random number between 0 and 1 |
RAND() >>0.2 |
randBetween | randBetween(min, max) Returns a random integer greater than or equal to the specified minimum value and less than the specified maximum value. |
randBetween(2, 44) >>9 |
|
Power / logarithm / factorial | fact | fact(number) Returns the factorial of a number, where the factorial of a number is equal to 1'2'3 *. * the number. |
FACT(3) >>6 |
factdouble | factDouble(number) Return the double factorial of the value |
factDouble(10) >>3840 |
|
POWER | power(number, power) The power result of the return number |
POWER(10, 2) >>100 |
|
exp | exp(power) Returns the power of the specified number of e |
exp(2) >>7.389056099 |
|
ln | ln(number) Returns the natural logarithm of the value |
LN(4) >>1.386294361 |
|
log | log(number[, baseNumber]) Returns the common logarithm of the value, such as omitting the base. The default is 10. |
LOG(100, 10) >>2 |
|
LOG10 | log10(number) Returns the 10 logarithm of the value |
LOG10(100) >>2 |
|
MULTINOMIAL | multinomial(number, ...) Returns the ratio of the factorial of the sum of parameters to the factorial product of each parameter |
MULTINOMIAL(1, 2, 3) >>60 |
|
PRODUCT | product(number, ...) Multiplies all values given as parameters and returns the product value. |
PRODUCT(1, 2, 3, 4) >>24 |
|
SqrtPi | SqrtPi(number) Returns the square root of the product of a number and PI |
SqrtPi(3) >>3.069980124 |
|
SUMSQ | sumQq(number, ...) Returns the sum of squares of parameters |
SUMSQ(1, 2) >>5 |
|
Transformation | DEC2BIN ★ | DEC2BIN(number[, digit]) Decimal to binary |
DEC2BIN(100) >> |
DEC2OCT ★ | DEC2OCT(number[, digit]) Decimal to octal |
DEC2OCT(100) >> |
|
DEC2HEX ★ | DEC2HEX(number[, digit]) Convert from decimal to hexadecimal |
DEC2HEX(100) >> |
|
HEX2BIN ★ | HEX2BIN(number[, digit]) Hexadecimal to binary |
HEX2BIN(100) >> |
|
HEX2OCT ★ | HEX2OCT(number[, digit]) Convert hexadecimal to octal |
HEX2OCT(100) >> |
|
HEX2DEC ★ | HEX2DEC(number) Hexadecimal to decimal |
HEX2DEC(100) >> |
|
OCT2BIN ★ | OCT2BIN(number[, digit]) Octal to binary |
OCT2BIN(100) >> |
|
OCT2DEC ★ | OCT2DEC(number) Octal to decimal |
OCT2DEC(100) >> |
|
OCT2HEX ★ | OCT2HEX(number[, digit]) Octal to hexadecimal |
OCT2HEX(100) >> |
|
BIN2OCT ★ | BIN2OCT(number[, digit]) Binary to octal |
BIN2OCT(100) >> |
|
BIN2DEC ★ | BIN2DEC(number) Binary to decimal |
BIN2DEC(100) >> |
|
BIN2HEX ★ | BIN2HEX(number[, digit]) Binary to hexadecimal |
BIN2HEX(100) >> |
function name | description | Example |
ASC ★ | asc(text) Change the full-width letters in a string to half-width characters |
asc('abcABC123') >>abcABC123 |
JIS ★ WIDECHAR ★ | jis(text) Change half-width English characters in a string to full-width characters |
jis('abcABC123') >>abcABC123 |
CHAR ★ | CHAR(number) Returns the character specified by the code value |
char(49) >>1 |
CLEAN ★ | clean(text) Delete all unprintable characters in the text |
clean('\r112\t') >>112 |
CODE ★ | code(text) Returns the numeric code of the first character in the text string |
CODE("1") >>49 |
CONCATENATE ★ | concatenate(text1, ...) Merge several text items into a single text item |
CONCATENATE('tt', '11') >>tt11 |
EXACT ★ | exact(text1, text2) Check whether the two text values are exactly the same |
EXACT("11", "22") >>false |
FIND ★ ▲ | find(text, findText[, startIndex]) Find another text value within one text value (case sensitive) |
FIND("11", "12221122") >>5 |
LEFT ★ | left(text[, count]) Returns the leftmost character of the text value |
LEFT('123222', 3) >>123 |
LEN ★ | len(text) Returns the number of characters in a text string |
LEN('123222') >>6 |
MID ★ ▲ | mid(text, startIndex, count) Returns a specific number of characters from a specified position in a text string |
MID('ABCDEF', 2, 3) >>BCD |
PROPER ★ | proper(text) Set the first letter of each word in the text value to uppercase |
PROPER('abc abc') >>Abc Abc |
REPLACE ★ ▲ | replace(srcText, startIndex, count, newText) replace(srcText, repalceText, newText) Replace characters in text |
REPLACE("abccd", 2, 3, "2") >>a2d REPLACE("abccd", "bc", "2") >>a2cd |
REPT ★ | rept(text, times) Repeat the text a given number of times |
REPT("q", 3) >>qqq |
RIGHT ★ | right(text[, count]) Returns the rightmost character of the text value |
RIGHT("123q", 3) >>23q |
RMB ★ | RMB(number) Convert numeric values to chinese uppercase numeric text |
RMB(12.3) >>壹拾贰元叁角 |
SEARCH ★ ▲ | search(findText, text[, startIndex]) Find another text value in one text value (case-insensitive) |
SEARCH("aa", "abbAaddd") >>4 |
SUBSTITUTE ★ | substitute(text, srcText, newText[, index]) Replace old text with new text in a text string |
SUBSTITUTE("ababcc", "ab", "12") >>1212cc |
T ★ | t(number) Convert parameters to text |
T('123') >>123 |
TEXT ★ | text(number, format) Format numeric values and convert them to text |
TEXT(123, "0.00") >>123.00 |
TRIM ★ | trim(text) Delete spaces in text |
TRIM(" 123 123 ") >>123 123 |
LOWER ★ TOLOWER ★ | lower(text) tolower(text) Convert text to lowercase |
LOWER('ABC') >>abc |
UPPER ★ TOUPPER ★ | upper(text) toupper(text) Convert text to uppercase |
UPPER("abc") >>ABC |
VALUE ★ | value(text) Convert text parameters to numeric values |
VALUE("123") >>123 |
function name | description | Example |
NOW | now() Returns the current date and time |
NOW() >>2017-01-07 11:00:00 |
TODAY | today() Return to today's date |
TODAY() >>2017-01-07 |
DateValue ★ | DateValue(text) Convert a text format to a date |
DateValue("2017-01-02") >>2017-01-02 |
TimeValue ★ | TimeValue(text) Convert text formatted time to date |
TimeValue("12:12:12") >>12:12:12 |
DATE ★ | date(year, month, day[, hour[, minute[, second]]]) Returns a specific date |
DATE(2016, 1, 1) >>2016-01-01 |
TIME ★ | time(hour, minute, second) Returns a specific time |
TIME(12, 13, 14) >>12:13:14 |
YEAR ★ | year(date) Returns year |
YEAR(NOW()) >>2017 |
MONTH ★ | month(date) Returns month |
MONTH(NOW()) >>1 |
DAY ★ | day(date) Returns day |
DAY(NOW()) >>7 |
HOUR ★ | hour(date) Returns hour |
HOUR(NOW()) >>11 |
MINUTE ★ | minute(date) Returns minute |
MINUTE(NOW()) >>12 |
SECOND ★ | second(date) Returns second |
SECOND(NOW()) >>34 |
WEEKDAY ★ | WEEKDAY(date) Returns weekday |
WEEKDAY(date(2017, 1, 7)) >>7 |
dateDIF | dateDif(startDate, endDate, type:Y/M/D/YD/MD/YM) Returns the number of days between two dates |
dateDIF("1975-1-30", "2017-1-7", "Y") >>41 |
DAYS360 | days360(startDate, endDate[, type:0/1]) Calculate the number of days in a two-day period on the basis of 360 days a year |
DAYS360('1975-1-30', '2017-1-7') >>15097 |
EDATE | eDate(startDate, month) Returns the serial number used to represent the number of months before or after the start date |
EDATE("2012-1-31", 32) >>2014-09-30 |
EOMONTH | eoMonth(startDate, month) Returns the serial number of the last day of the month before or after the specified number of months |
EOMONTH("2012-2-1", 32) >>2014-10-31 |
netWorkdays | netWorkdays(startDate, endDate[, holidays]) Returns the total number of working days between two dates |
netWorkdays("2012-1-1", "2013-1-1") >>262 |
workDay | workday(startDate, days[, holidays]) Returns the serial number of the date before or after the specified number of working days |
workDay("2012-1-2", 145) >>2012-07-23 |
WEEKNUM | weekNum(date[, type:1/2]) Returns week number |
WEEKNUM("2016-1-3") >>2 |
function name | description | Example |
AddYears ★ | AddYears(date, number) Add Years | |
AddMonths ★ | AddMonths(date, number) Add Months | |
AddDays ★ | AddDays(date, number) Add Days | |
AddHours ★ | AddHours(date, number) Add Hours | |
AddMinutes ★ | AddMinutes(date, number) Add Minutes | |
AddSeconds ★ | AddSeconds(date, number) Add Seconds | |
DateValue ★ | DateValue(value, number) Conversion time DateValue(text/number, 0) Parse, automatically match to a date similar to the current date DateValue(text, 1) Conversion date, text format DateValue(number, 2) Conversion date, Excel value DateValue(number, 3) Convert to date, timestamp (milliseconds) DateValue(number, 4) Convert to date, timestamp (seconds) | |
Timestamp ★ | Timestamp(date[, type:0/1]) Switch to timestamp. Default is millisecond. Timestamp(date, 0) Convert to timestamp (milliseconds) Timestamp(date, 1) Convert to timestamp (seconds) |
Note: The UseLocalTime
attribute affects the conversion of DateValue
/Timestamp
. Set true
to directly convert to local time.
function name | description | Example |
MAX | max(number, ...) Returns the maximum value in the parameter list |
max(1, 2, 3, 4, 2, 2, 1, 4) >>4 |
MEDIAN | median(number, ...) Returns the median of a given value |
MEDIAN(1, 2, 3, 4, 2, 2, 1, 4) >>2 |
MIN | min(number, ...) Returns the minimum value in the parameter list |
MIN(1, 2, 3, 4, 2, 2, 1, 4) >>1 |
QUARTILE | quartile(number, quartile:0-4) Returns the quartile of the dataset |
QUARTILE({1, 2, 3, 4, 2, 2, 1, 4}, 0) >>1 |
MODE | mode(number, ...) Returns the number that occurs most frequently in the array |
MODE(1, 2, 3, 4, 2, 2, 1, 4) >>2 |
LARGE ▲ | large(array, K) Returns the k largest value of the data set |
LARGE({1, 2, 3, 4, 2, 2, 1, 4}, 3) >>3 |
SMALL ▲ | small(number, K) Returns the k-th minimum of the data set |
SMALL({1, 2, 3, 4, 2, 2, 1, 4}, 3) >>2 |
PERCENTILE | percentile(number, K) Returns the k percentile in the area |
PERCENTILE({1, 2, 3, 4, 2, 2, 1, 4}, 0.4) >>2 |
PERCENTRANK | percentRank(number, K) Returns the percentage ranking of the values in the data set |
PERCENTRANK({1, 2, 3, 4, 2, 2, 1, 4}, 3) >>0.714 |
AVERAGE | average(number, ...) Returns the average value of the parameter |
AVERAGE(1, 2, 3, 4, 2, 2, 1, 4) >>2.375 |
averageIf | averageIf({number1, ...}, condition[, {number1, ...}]) Returns the average value of the parameter |
averageIf({1, 2, 3, 4, 2, 2, 1, 4}, '>1') >>2.833333333 |
GEOMEAN | geoMean(number, ...) Returns the geometric mean of a positive array or region |
GEOMEAN(1, 2, 3, 4) >>2.213363839 |
HARMEAN | harMean(number, ...) Returns the harmonic average of the data set |
HARMEAN(1, 2, 3, 4) >>1.92 |
COUNT | count(number, ...) Calculate the number of values in the parameter list |
COUNT(1, 2, 3, 4, 2, 2, 1, 4) >>8 |
countIf | countIf({number1, ...}, condition[, {number1, ...}]) Calculate the number of values in the parameter list |
countIf({1, 2, 3, 4, 2, 2, 1, 4}, '>1') >>6 |
SUM | sum(number, ...) Returns the sum of all values. |
SUM(1, 2, 3, 4) >>10 |
sumIf | sumIf({number, ...}, condition[, {number1, ...}]) Returns the sum of all values. |
sumIf({1, 2, 3, 4, 2, 2, 1, 4}, '>1') >>17 |
AVEDEV | aveDev(number, ...) Returns the average of the absolute deviation of a data point from its average |
AVEDEV(1, 2, 3, 4, 2, 2, 1, 4) >>0.96875 |
STDEV | stDev(number, ...) Estimation of standard deviation based on samples |
STDEV(1, 2, 3, 4, 2, 2, 1, 4) >>1.1877349391654208 |
STDEVP | stDevp(number, ...) Calculate the standard deviation based on the whole sample population |
STDEVP(1, 2, 3, 4, 2, 2, 1, 4) >>1.1110243021644486 |
DEVSQ | devSq(number, ...) Returns the sum of squares of deviations |
DEVSQ(1, 2, 3, 4, 2, 2, 1, 4) >>9.875 |
VAR | var(number, ...) Estimation of variance based on samples |
VAR(1, 2, 3, 4, 2, 2, 1, 4) >>1.4107142857142858 |
VARP | varp(number, ...) Calculate the variance based on the whole sample population |
VARP(1, 2, 3, 4, 2, 2, 1, 4) >>1.234375 |
normDist | normDist(number, arithmeticMean, StDev, returnType:0/1) Return to normal cumulative distribution |
normDist(3, 8, 4, 1) >>0.105649774 |
normInv | normInv(distributionProbability, arithmeticMean, StDev) Returns the anti-normal cumulative distribution |
normInv(0.8, 8, 3) >>10.5248637 |
NormSDist | normSDist(number) Returns the standard normal cumulative distribution function, with an average of 0 and a standard deviation of 1. |
NORMSDist(1) >>0.841344746 |
normSInv | normSInv(number) Return anti-standard normal cumulative distribution |
normSInv(0.3) >>-0.524400513 |
BetaDist | BetaDist(number, α, β) Returns the Beta cumulative distribution function |
BetaDist(0.5, 11, 22) >>0.97494877 |
BetaInv | BetaInv(number, α, β) Returns the inverse function of the cumulative distribution function of the specified Beta distribution |
BetaInv(0.5, 23, 45) >>0.336640759 |
binomDist | binomDist(successCount, testCount, successProbability, returnType:0/1) Returns the probability of unary binomial distribution |
binomDist(12, 45, 0.5, 0) >>0.000817409 |
exponDist | exponDist(number, value, returnType:0/1) Return exponential distribution |
exponDist(3, 1, 0) >>0.049787068 |
FDist | fDist(numberX, molecularFreedom, denominatorFreedom) Return F probability distribution |
FDist(0.4, 2, 3) >>0.701465776 |
FInv | fInv(distributionProbability, molecularFreedom, denominatorFreedom) Returns the inverse function of F probability distribution |
FInv(0.7, 2, 3) >>0.402651432 |
FISHER | fisher(number) Returns the Fisher transformation of point x. The transformation produces a normal distribution rather than a skewed function. |
FISHER(0.68) >>0.8291140383 |
fisherInv | fisherInv(number) Returns the inverse value of the Fisher transform. |
fisherInv(0.6) >>0.537049567 |
gammaDist | gammaDist(number, α, β, returnType:0/1) Return gamma distribution |
gammaDist(0.5, 3, 4, 0) >>0.001723627 |
gammaInv | gammaInv(distributionProbability, α, β) Returns the inverse function of the gamma cumulative distribution function |
gammaInv(0.2, 3, 4) >>6.140176811 |
GAMMALN | gammaLn(number) Returns the natural logarithm of γ |
GAMMALN(4) >>1.791759469 |
hypgeomDist | hypgeomDist(successCount, testCount, successCountAll, testCountAll) Returns the hypergeometric distribution |
hypgeomDist(23, 45, 45, 100) >>0.08715016 |
logInv | logInv(distributionProbability, average, StDev) Returns the inverse function of the logarithmic cumulative distribution function of x |
logInv(0.1, 45, 33) >>15.01122624 |
LognormDist | lognormDist(number, average, StDev) Returns the inverse normal distribution |
lognormDist(15, 23, 45) >>0.326019201 |
negbinomDist | negbinomDist(failureCount, successCount, successProbability) Returns negative binomial distribution |
negbinomDist(23, 45, 0.7) >>0.053463314 |
POISSON | poisson(number, average, returnType:0/1) Returns the Poisson distribution |
POISSON(23, 23, 0) >>0.082884384 |
TDist | tDist(number, freedom, returnType:1/2) Returns the t distribution of students |
TDist(1.2, 24, 1) >>0.120925677 |
TInv | TInv(distributionProbability, freedom) Returns the inverse distribution of students't-distribution |
TInv(0.12, 23) >>1.614756561 |
WEIBULL | weibull(number, α, β, returnType:0/1) Returns the Weibull distribution |
WEIBULL(1, 2, 3, 1) >>0.105160683 |
function name | description | Example |
VLookUp ★ ▲ | VLookUp({array, ...}, value, {colIndex}[, fuzzy:0/1]) Vertical search function. Fuzzy matching default 1 | |
VLookUp ★ ▲ | VLookUp({Json, ...}, formula, name) JSON array lookup function. |
function name | description | Example |
UrlEncode ★ | UrlEncode(text) Encode the URL string. | |
UrlDecode ★ | UrlEncode(text) Converts an URL-encoded string to a decoded string. | |
HtmlEncode ★ | HtmlEncode(text) Converts a string to a HTML-encoded string. | |
HtmlDecode ★ | HtmlDecode(text) Transdecode the HTML-encoded string. | |
Base64ToText ★ | Base64ToText(text[, encodingType]) Converts Base64 to a string. | |
Base64UrlToText ★ | Base64UrlToText(text[, encodingType]) Converts a Base64 of type Url to a string. | |
TextToBase64 ★ | TextToBase64(text[, encodingType]) Converts a string to an Base64 string. | |
TextToBase64Url ★ | TextToBase64Url(text[, encodingType]) Converts a string to an Base64 string of type Url. | |
Regex ★ ▲ | Regex(text, matchText) returns a matching string. | |
RegexRepalce ★ | RegexRepalce(text, matchText, replaceString) Matches the replacement string. | |
IsRegex ★ IsMatch ★ | IsRegex(text, matchText) IsMatch(text, matchText) To determine if there is a match. | |
Guid | Guid() Generate a Guid string. | |
Md5 ★ | Md5(text[, encodingType]) Returns the Hash string of Md5. | |
Sha1 ★ | Sha1(text[, encodingType]) Returns the Hash string of Sha1. | |
Sha256 ★ | Sha256(text[, encodingType]) Returns the Hash string of Sha256. | |
Sha512 ★ | Sha512(text[, encodingType]) Returns the Hash string of Sha512. | |
Crc32 ★ | Crc32(text[, encodingType]) Returns the Hash string of Crc32. | |
HmacMd5 ★ | HmacMd5(text, secret[, encodingType]) Returns the Hash string of HmacMd5. | |
HmacSha1 ★ | HmacSha1(text, secret[, encodingType]) Returns the Hash string of HmacSha1. | |
HmacSha256 ★ | HmacSha256(text, secret[, encodingType]) Returns the Hash string of HmacSha256. | |
HmacSha512 ★ | HmacSha512(text, secret[, encodingType]) Returns the Hash string of HmacSha512. | |
TrimStart ★ LTrim ★ | TrimStart(text) LTrim(text) LTrim(text[, characterSet]) Empty the left side of the string. | |
TrimEnd ★ RTrim ★ | TrimEnd(text) RTrim(text) RTrim(text, characterSet) Empty the right side of the string. | |
IndexOf ★ ▲ | IndexOf(text, find[, start[, index]]) Find the position of the string. | |
LastIndexOf ★ ▲ | LastIndexOf(text, find[, start[, index]]) Find the position of the string. | |
Split ★ | Split(text, separator) Generate array Split(text, separator, index) Returns the string pointed to by the split index. | |
Join ★ | Join(text1, text2....) Merge strings. | |
Substring ★ ▲ | Substring(text, start) Substring(text, start, count) Cut the string. | |
StartsWith ★ | StartsWith(text, startText[, ignoreCase:1/0]) Determines whether the beginning of this string instance matches the specified string. | |
EndsWith ★ | EndsWith(text, startText[, ignoreCase:1/0]) Determines whether the end of this string instance matches the specified string when comparing using the specified comparison option. | |
IsNullOrEmpty ★ | IsNullOrEmpty(text) Indicates whether the specified string is null or an empty string. | |
IsNullOrWhiteSpace ★ | IsNullOrWhiteSpace(text) Indicates whether the specified string is null, empty, or consisting only of white space characters. | |
RemoveStart ★ | RemoveStart(text, leftText[, ignoreCase]) Match the left, and if you succeed, remove the left string. | |
RemoveEnd ★ | RemoveEnd(text, rightText[, ignoreCase]) Match the right, and if you succeed, remove the string on the right. | |
Json ★ | json(text) Dynamic json query. | |
Error | Error(text) Proactively throwing error. | |
HAS ★ HASKEY ★ CONTAINS ★ CONTAINSKEY ★ | HAS(json/array,text) Does the JSON format include a Key Does the array contain values | |
HASVALUE ★ CONTAINSVALUE ★ | HASVALUE(json/array, text) Does the JSON format include a Value Does the array contain values | |
PARAM PARAMETER GETPARAMETER | GETPARAMETER(text) Dynamically obtaining parameters |