Example #1
0
 public static void Register(CalcEngine ce)
 {
     ce.RegisterFunction("ASC", 1, Asc); // Changes full-width (double-byte) English letters or katakana within a character string to half-width (single-byte) characters
     //ce.RegisterFunction("BAHTTEXT	Converts a number to text, using the ß (baht) currency format
     ce.RegisterFunction("CHAR", 1, _Char); // Returns the character specified by the code number
     ce.RegisterFunction("CLEAN", 1, Clean); //	Removes all nonprintable characters from text
     ce.RegisterFunction("CODE", 1, Code); // Returns a numeric code for the first character in a text string
     ce.RegisterFunction("CONCATENATE", 1, int.MaxValue, Concat); //	Joins several text items into one text item
     ce.RegisterFunction("DOLLAR", 1, 2, Dollar); // Converts a number to text, using the $ (dollar) currency format
     ce.RegisterFunction("EXACT", 2, Exact); // Checks to see if two text values are identical
     ce.RegisterFunction("FIND", 2, 3, Find); //Finds one text value within another (case-sensitive)
     ce.RegisterFunction("FIXED", 1, 3, Fixed); // Formats a number as text with a fixed number of decimals
     //ce.RegisterFunction("JIS	Changes half-width (single-byte) English letters or katakana within a character string to full-width (double-byte) characters
     ce.RegisterFunction("LEFT", 1, 2, Left); // LEFTB	Returns the leftmost characters from a text value
     ce.RegisterFunction("LEN", 1, Len); //, Returns the number of characters in a text string
     ce.RegisterFunction("LOWER", 1, Lower); //	Converts text to lowercase
     ce.RegisterFunction("MID", 3, Mid); // Returns a specific number of characters from a text string starting at the position you specify
     //ce.RegisterFunction("PHONETIC	Extracts the phonetic (furigana) characters from a text string
     ce.RegisterFunction("PROPER", 1, Proper); // Capitalizes the first letter in each word of a text value
     ce.RegisterFunction("REPLACE", 4, Replace); // Replaces characters within text
     ce.RegisterFunction("REPT", 2, Rept); // Repeats text a given number of times
     ce.RegisterFunction("RIGHT", 1, 2, Right); // Returns the rightmost characters from a text value
     ce.RegisterFunction("SEARCH", 2, Search); // Finds one text value within another (not case-sensitive)
     ce.RegisterFunction("SUBSTITUTE", 3, 4, Substitute); // Substitutes new text for old text in a text string
     ce.RegisterFunction("T", 1, T); // Converts its arguments to text
     ce.RegisterFunction("TEXT", 2, _Text); // Formats a number and converts it to text
     ce.RegisterFunction("TRIM", 1, Trim); // Removes spaces from text
     ce.RegisterFunction("UPPER", 1, Upper); // Converts text to uppercase
     ce.RegisterFunction("VALUE", 1, Value); // Converts a text argument to a number
     ce.RegisterFunction("HYPERLINK", 1, Hyperlink);
 }
Example #2
0
 public static void Register(CalcEngine ce)
 {
     ce.RegisterFunction("AND", 1, int.MaxValue, And);
     ce.RegisterFunction("OR", 1, int.MaxValue, Or);
     ce.RegisterFunction("NOT", 1, Not);
     ce.RegisterFunction("IF", 2, 3, If);
     ce.RegisterFunction("TRUE", 0, True);
     ce.RegisterFunction("FALSE", 0, False);
 }
 public ExpressionCache(CalcEngine ce)
 {
     _ce = ce;
     _dct = new Dictionary<string, WeakReference>();
 }
        private static bool ValueSatisfiesCriteria(object value, object criteria, CalcEngine ce)
        {
            // safety...
            if (value == null)
            {
                return false;
            }

            // if criteria is a number, straight comparison
            if (criteria is double)
            {
                return (double) value == (double) criteria;
            }

            // convert criteria to string
            var cs = criteria as string;
            if (!string.IsNullOrEmpty(cs))
            {
                // if criteria is an expression (e.g. ">20"), use calc engine
                if (cs[0] == '=' || cs[0] == '<' || cs[0] == '>')
                {
                    // build expression
                    var expression = string.Format("{0}{1}", value, cs);

                    // add quotes if necessary
                    var pattern = @"(\w+)(\W+)(\w+)";
                    var m = Regex.Match(expression, pattern);
                    if (m.Groups.Count == 4)
                    {
                        double d;
                        if (!double.TryParse(m.Groups[1].Value, out d) ||
                            !double.TryParse(m.Groups[3].Value, out d))
                        {
                            expression = string.Format("\"{0}\"{1}\"{2}\"",
                                                       m.Groups[1].Value,
                                                       m.Groups[2].Value,
                                                       m.Groups[3].Value);
                        }
                    }

                    // evaluate
                    return (bool) ce.Evaluate(expression);
                }

                // if criteria is a regular expression, use regex
                if (cs.IndexOf('*') > -1)
                {
                    var pattern = cs.Replace(@"\", @"\\");
                    pattern = pattern.Replace(".", @"\");
                    pattern = pattern.Replace("*", ".*");
                    return Regex.IsMatch(value.ToString(), pattern, RegexOptions.IgnoreCase);
                }

                // straight string comparison 
                return string.Equals(value.ToString(), cs, StringComparison.OrdinalIgnoreCase);
            }

            // should never get here?
            Debug.Assert(false, "failed to evaluate criteria in SumIf");
            return false;
        }
        private static object SumIf(List<Expression> p)
        {
            // get parameters
            var range = p[0] as IEnumerable;
            var sumRange = p.Count < 3 ? range : p[2] as IEnumerable;
            var criteria = p[1].Evaluate();

            // build list of values in range and sumRange
            var rangeValues = new List<object>();
            foreach (var value in range)
            {
                rangeValues.Add(value);
            }
            var sumRangeValues = new List<object>();
            foreach (var value in sumRange)
            {
                sumRangeValues.Add(value);
            }

            // compute total
            var ce = new CalcEngine();
            var tally = new Tally();
            for (var i = 0; i < Math.Min(rangeValues.Count, sumRangeValues.Count); i++)
            {
                if (ValueSatisfiesCriteria(rangeValues[i], criteria, ce))
                {
                    tally.AddValue(sumRangeValues[i]);
                }
            }

            // done
            return tally.Sum();
        }
 public static void Register(CalcEngine ce)
 {
     ce.RegisterFunction("ABS", 1, Abs);
     ce.RegisterFunction("ACOS", 1, Acos);
     ce.RegisterFunction("ACOSH", 1, Acosh);
     ce.RegisterFunction("ASIN", 1, Asin);
     ce.RegisterFunction("ASINH", 1, Asinh);
     ce.RegisterFunction("ATAN", 1, Atan);
     ce.RegisterFunction("ATAN2", 2, Atan2);
     ce.RegisterFunction("ATANH", 1, Atanh);
     ce.RegisterFunction("CEILING", 1, Ceiling);
     ce.RegisterFunction("COMBIN", 2, Combin);
     ce.RegisterFunction("COS", 1, Cos);
     ce.RegisterFunction("COSH", 1, Cosh);
     ce.RegisterFunction("DEGREES", 1, Degrees);
     ce.RegisterFunction("EVEN", 1, Even);
     ce.RegisterFunction("EXP", 1, Exp);
     ce.RegisterFunction("FACT", 1, Fact);
     ce.RegisterFunction("FACTDOUBLE", 1, FactDouble);
     ce.RegisterFunction("FLOOR", 1, Floor);
     ce.RegisterFunction("GCD", 1, 255, Gcd);
     ce.RegisterFunction("INT", 1, Int);
     ce.RegisterFunction("LCM", 1, 255, Lcm);
     ce.RegisterFunction("LN", 1, Ln);
     ce.RegisterFunction("LOG", 1, 2, Log);
     ce.RegisterFunction("LOG10", 1, Log10);
     ce.RegisterFunction("MDETERM", 1, MDeterm);
     ce.RegisterFunction("MINVERSE", 1, MInverse);
     ce.RegisterFunction("MMULT", 2, MMult);
     ce.RegisterFunction("MOD", 2, Mod);
     ce.RegisterFunction("MROUND", 2, MRound);
     ce.RegisterFunction("MULTINOMIAL", 1, 255, Multinomial);
     ce.RegisterFunction("ODD", 1, Odd);
     ce.RegisterFunction("PI", 0, Pi);
     ce.RegisterFunction("POWER", 2, Power);
     ce.RegisterFunction("PRODUCT", 1, 255, Product);
     ce.RegisterFunction("QUOTIENT", 2, Quotient);
     ce.RegisterFunction("RADIANS", 1, Radians);
     ce.RegisterFunction("RAND", 0, Rand);
     ce.RegisterFunction("RANDBETWEEN", 2, RandBetween);
     ce.RegisterFunction("ROMAN", 1, 2, Roman);
     ce.RegisterFunction("ROUND", 2, Round);
     ce.RegisterFunction("ROUNDDOWN", 2, RoundDown);
     ce.RegisterFunction("ROUNDUP", 1, 2, RoundUp);
     ce.RegisterFunction("SERIESSUM", 4, SeriesSum);
     ce.RegisterFunction("SIGN", 1, Sign);
     ce.RegisterFunction("SIN", 1, Sin);
     ce.RegisterFunction("SINH", 1, Sinh);
     ce.RegisterFunction("SQRT", 1, Sqrt);
     ce.RegisterFunction("SQRTPI", 1, SqrtPi);
     ce.RegisterFunction("SUBTOTAL", 2, 255, Subtotal);
     ce.RegisterFunction("SUM", 1, int.MaxValue, Sum);
     ce.RegisterFunction("SUMIF", 2, 3, SumIf);
     //ce.RegisterFunction("SUMPRODUCT", 1, SumProduct);
     ce.RegisterFunction("SUMSQ", 1, 255, SumSq);
     //ce.RegisterFunction("SUMX2MY2", SumX2MY2, 1);
     //ce.RegisterFunction("SUMX2PY2", SumX2PY2, 1);
     //ce.RegisterFunction("SUMXMY2", SumXMY2, 1);
     ce.RegisterFunction("TAN", 1, Tan);
     ce.RegisterFunction("TANH", 1, Tanh);
     ce.RegisterFunction("TRUNC", 1, Trunc);
 }
Example #7
0
 public static void Register(CalcEngine ce)
 {
     ce.RegisterFunction("ISBLANK", 1, IsBlank);
 }
 public static void Register(CalcEngine ce)
 {
     //ce.RegisterFunction("AVEDEV", AveDev, 1, int.MaxValue);
     ce.RegisterFunction("AVERAGE", 1, int.MaxValue, Average);
     ce.RegisterFunction("AVERAGEA", 1, int.MaxValue, AverageA);
     //BETADIST	Returns the beta cumulative distribution function
     //BETAINV	Returns the inverse of the cumulative distribution function for a specified beta distribution
     //BINOMDIST	Returns the individual term binomial distribution probability
     //CHIDIST	Returns the one-tailed probability of the chi-squared distribution
     //CHIINV	Returns the inverse of the one-tailed probability of the chi-squared distribution
     //CHITEST	Returns the test for independence
     //CONFIDENCE	Returns the confidence interval for a population mean
     //CORREL	Returns the correlation coefficient between two data sets
     ce.RegisterFunction("COUNT", 1, int.MaxValue, Count);
     ce.RegisterFunction("COUNTA", 1, int.MaxValue, CountA);
     ce.RegisterFunction("COUNTBLANK", 1, int.MaxValue, CountBlank);
     ce.RegisterFunction("COUNTIF", 2, CountIf);
     //COVAR	Returns covariance, the average of the products of paired deviations
     //CRITBINOM	Returns the smallest value for which the cumulative binomial distribution is less than or equal to a criterion value
     //DEVSQ	Returns the sum of squares of deviations
     //EXPONDIST	Returns the exponential distribution
     //FDIST	Returns the F probability distribution
     //FINV	Returns the inverse of the F probability distribution
     //FISHER	Returns the Fisher transformation
     //FISHERINV	Returns the inverse of the Fisher transformation
     //FORECAST	Returns a value along a linear trend
     //FREQUENCY	Returns a frequency distribution as a vertical array
     //FTEST	Returns the result of an F-test
     //GAMMADIST	Returns the gamma distribution
     //GAMMAINV	Returns the inverse of the gamma cumulative distribution
     //GAMMALN	Returns the natural logarithm of the gamma function, Γ(x)
     //GEOMEAN	Returns the geometric mean
     //GROWTH	Returns values along an exponential trend
     //HARMEAN	Returns the harmonic mean
     //HYPGEOMDIST	Returns the hypergeometric distribution
     //INTERCEPT	Returns the intercept of the linear regression line
     //KURT	Returns the kurtosis of a data set
     //LARGE	Returns the k-th largest value in a data set
     //LINEST	Returns the parameters of a linear trend
     //LOGEST	Returns the parameters of an exponential trend
     //LOGINV	Returns the inverse of the lognormal distribution
     //LOGNORMDIST	Returns the cumulative lognormal distribution
     ce.RegisterFunction("MAX", 1, int.MaxValue, Max);
     ce.RegisterFunction("MAXA", 1, int.MaxValue, MaxA);
     //MEDIAN	Returns the median of the given numbers
     ce.RegisterFunction("MIN", 1, int.MaxValue, Min);
     ce.RegisterFunction("MINA", 1, int.MaxValue, MinA);
     //MODE	Returns the most common value in a data set
     //NEGBINOMDIST	Returns the negative binomial distribution
     //NORMDIST	Returns the normal cumulative distribution
     //NORMINV	Returns the inverse of the normal cumulative distribution
     //NORMSDIST	Returns the standard normal cumulative distribution
     //NORMSINV	Returns the inverse of the standard normal cumulative distribution
     //PEARSON	Returns the Pearson product moment correlation coefficient
     //PERCENTILE	Returns the k-th percentile of values in a range
     //PERCENTRANK	Returns the percentage rank of a value in a data set
     //PERMUT	Returns the number of permutations for a given number of objects
     //POISSON	Returns the Poisson distribution
     //PROB	Returns the probability that values in a range are between two limits
     //QUARTILE	Returns the quartile of a data set
     //RANK	Returns the rank of a number in a list of numbers
     //RSQ	Returns the square of the Pearson product moment correlation coefficient
     //SKEW	Returns the skewness of a distribution
     //SLOPE	Returns the slope of the linear regression line
     //SMALL	Returns the k-th smallest value in a data set
     //STANDARDIZE	Returns a normalized value
     ce.RegisterFunction("STDEV", 1, int.MaxValue, StDev);
     ce.RegisterFunction("STDEVA", 1, int.MaxValue, StDevA);
     ce.RegisterFunction("STDEVP", 1, int.MaxValue, StDevP);
     ce.RegisterFunction("STDEVPA", 1, int.MaxValue, StDevPA);
     //STEYX	Returns the standard error of the predicted y-value for each x in the regression
     //TDIST	Returns the Student's t-distribution
     //TINV	Returns the inverse of the Student's t-distribution
     //TREND	Returns values along a linear trend
     //TRIMMEAN	Returns the mean of the interior of a data set
     //TTEST	Returns the probability associated with a Student's t-test
     ce.RegisterFunction("VAR", 1, int.MaxValue, Var);
     ce.RegisterFunction("VARA", 1, int.MaxValue, VarA);
     ce.RegisterFunction("VARP", 1, int.MaxValue, VarP);
     ce.RegisterFunction("VARPA", 1, int.MaxValue, VarPA);
     //WEIBULL	Returns the Weibull distribution
     //ZTEST	Returns the one-tailed probability-value of a z-test
 }
 static object CountIf(List<Expression> p)
 {
     CalcEngine ce = new CalcEngine();
     var cnt = 0.0;
     var ienum = p[0] as IEnumerable;
     if (ienum != null)
     {
         var crit = (string)p[1].Evaluate();
         foreach (var value in ienum)
         {
             if (!IsBlank(value))
             {
                 var exp = string.Format("{0}{1}", value, crit);
                 if ((bool)ce.Evaluate(exp))
                     cnt++;
             }
         }
     }
     return cnt;
 }
Example #10
0
 public ExpressionCache(CalcEngine ce)
 {
     _ce  = ce;
     _dct = new Dictionary <string, WeakReference>();
 }
Example #11
0
        private static object SumIfs(List <Expression> p)
        {
            // get parameters
            var sumRange = p[0] as IEnumerable;

            var sumRangeValues = new List <object>();

            foreach (var value in sumRange)
            {
                sumRangeValues.Add(value);
            }

            var ce    = new CalcEngine();
            var tally = new Tally();

            int numberOfCriteria = p.Count / 2; // int division returns floor() automatically, that's what we want.

            // prepare criteria-parameters:
            var criteriaRanges = new Tuple <object, IList <object> > [numberOfCriteria];

            for (int criteriaPair = 0; criteriaPair < numberOfCriteria; criteriaPair++)
            {
                var criteriaRange = p[criteriaPair * 2 + 1] as IEnumerable;

                if (criteriaRange == null)
                {
                    throw new CellReferenceException($"Expected parameter {criteriaPair * 2 + 2} to be a range");
                }

                var criterion           = p[criteriaPair * 2 + 2].Evaluate();
                var criteriaRangeValues = criteriaRange.Cast <Object>().ToList();

                criteriaRanges[criteriaPair] = new Tuple <object, IList <object> >(
                    criterion,
                    criteriaRangeValues);
            }

            for (var i = 0; i < sumRangeValues.Count; i++)
            {
                bool shouldUseValue = true;

                foreach (var criteriaPair in criteriaRanges)
                {
                    if (!CalcEngineHelpers.ValueSatisfiesCriteria(
                            i < criteriaPair.Item2.Count ? criteriaPair.Item2[i] : string.Empty,
                            criteriaPair.Item1,
                            ce))
                    {
                        shouldUseValue = false;
                        break; // we're done with the inner loop as we can't ever get true again.
                    }
                }

                if (shouldUseValue)
                {
                    tally.AddValue(sumRangeValues[i]);
                }
            }

            // done
            return(tally.Sum());
        }
Example #12
0
 public static void Register(CalcEngine ce)
 {
     ce.RegisterFunction("ABS", 1, Abs);
     ce.RegisterFunction("ACOS", 1, Acos);
     ce.RegisterFunction("ACOSH", 1, Acosh);
     ce.RegisterFunction("ACOT", 1, Acot);
     ce.RegisterFunction("ACOTH", 1, Acoth);
     ce.RegisterFunction("ARABIC", 1, Arabic);
     ce.RegisterFunction("ASIN", 1, Asin);
     ce.RegisterFunction("ASINH", 1, Asinh);
     ce.RegisterFunction("ATAN", 1, Atan);
     ce.RegisterFunction("ATAN2", 2, Atan2);
     ce.RegisterFunction("ATANH", 1, Atanh);
     ce.RegisterFunction("BASE", 2, 3, Base);
     ce.RegisterFunction("CEILING", 2, Ceiling);
     ce.RegisterFunction("CEILING.MATH", 1, 3, CeilingMath);
     ce.RegisterFunction("COMBIN", 2, Combin);
     ce.RegisterFunction("COMBINA", 2, CombinA);
     ce.RegisterFunction("COS", 1, Cos);
     ce.RegisterFunction("COSH", 1, Cosh);
     ce.RegisterFunction("COT", 1, Cot);
     ce.RegisterFunction("COTH", 1, Coth);
     ce.RegisterFunction("CSC", 1, Csc);
     ce.RegisterFunction("CSCH", 1, Csch);
     ce.RegisterFunction("DECIMAL", 2, MathTrig.Decimal);
     ce.RegisterFunction("DEGREES", 1, Degrees);
     ce.RegisterFunction("EVEN", 1, Even);
     ce.RegisterFunction("EXP", 1, Exp);
     ce.RegisterFunction("FACT", 1, Fact);
     ce.RegisterFunction("FACTDOUBLE", 1, FactDouble);
     ce.RegisterFunction("FLOOR", 2, Floor);
     ce.RegisterFunction("FLOOR.MATH", 1, 3, FloorMath);
     ce.RegisterFunction("GCD", 1, 255, Gcd);
     ce.RegisterFunction("INT", 1, Int);
     ce.RegisterFunction("LCM", 1, 255, Lcm);
     ce.RegisterFunction("LN", 1, Ln);
     ce.RegisterFunction("LOG", 1, 2, Log);
     ce.RegisterFunction("LOG10", 1, Log10);
     ce.RegisterFunction("MDETERM", 1, MDeterm);
     ce.RegisterFunction("MINVERSE", 1, MInverse);
     ce.RegisterFunction("MMULT", 2, MMult);
     ce.RegisterFunction("MOD", 2, Mod);
     ce.RegisterFunction("MROUND", 2, MRound);
     ce.RegisterFunction("MULTINOMIAL", 1, 255, Multinomial);
     ce.RegisterFunction("ODD", 1, Odd);
     ce.RegisterFunction("PI", 0, Pi);
     ce.RegisterFunction("POWER", 2, Power);
     ce.RegisterFunction("PRODUCT", 1, 255, Product);
     ce.RegisterFunction("QUOTIENT", 2, Quotient);
     ce.RegisterFunction("RADIANS", 1, Radians);
     ce.RegisterFunction("RAND", 0, Rand);
     ce.RegisterFunction("RANDBETWEEN", 2, RandBetween);
     ce.RegisterFunction("ROMAN", 1, 2, Roman);
     ce.RegisterFunction("ROUND", 2, Round);
     ce.RegisterFunction("ROUNDDOWN", 2, RoundDown);
     ce.RegisterFunction("ROUNDUP", 1, 2, RoundUp);
     ce.RegisterFunction("SEC", 1, Sec);
     ce.RegisterFunction("SECH", 1, Sech);
     ce.RegisterFunction("SERIESSUM", 4, SeriesSum);
     ce.RegisterFunction("SIGN", 1, Sign);
     ce.RegisterFunction("SIN", 1, Sin);
     ce.RegisterFunction("SINH", 1, Sinh);
     ce.RegisterFunction("SQRT", 1, Sqrt);
     ce.RegisterFunction("SQRTPI", 1, SqrtPi);
     ce.RegisterFunction("SUBTOTAL", 2, 255, Subtotal);
     ce.RegisterFunction("SUM", 1, int.MaxValue, Sum);
     ce.RegisterFunction("SUMIF", 2, 3, SumIf);
     ce.RegisterFunction("SUMIFS", 3, 255, SumIfs);
     ce.RegisterFunction("SUMPRODUCT", 1, 30, SumProduct);
     ce.RegisterFunction("SUMSQ", 1, 255, SumSq);
     //ce.RegisterFunction("SUMX2MY2", SumX2MY2, 1);
     //ce.RegisterFunction("SUMX2PY2", SumX2PY2, 1);
     //ce.RegisterFunction("SUMXMY2", SumXMY2, 1);
     ce.RegisterFunction("TAN", 1, Tan);
     ce.RegisterFunction("TANH", 1, Tanh);
     ce.RegisterFunction("TRUNC", 1, 2, Trunc);
 }
Example #13
0
 public static void Register(CalcEngine ce)
 {
     //ce.RegisterFunction("AVEDEV", AveDev, 1, int.MaxValue);
     ce.RegisterFunction("AVERAGE", 1, int.MaxValue, Average); // Returns the average (arithmetic mean) of the arguments
     ce.RegisterFunction("AVERAGEA", 1, int.MaxValue, AverageA);
     //BETADIST	Returns the beta cumulative distribution function
     //BETAINV	Returns the inverse of the cumulative distribution function for a specified beta distribution
     //BINOMDIST	Returns the individual term binomial distribution probability
     //CHIDIST	Returns the one-tailed probability of the chi-squared distribution
     //CHIINV	Returns the inverse of the one-tailed probability of the chi-squared distribution
     //CHITEST	Returns the test for independence
     //CONFIDENCE	Returns the confidence interval for a population mean
     //CORREL	Returns the correlation coefficient between two data sets
     ce.RegisterFunction("COUNT", 1, int.MaxValue, Count);
     ce.RegisterFunction("COUNTA", 1, int.MaxValue, CountA);
     ce.RegisterFunction("COUNTBLANK", 1, CountBlank);
     ce.RegisterFunction("COUNTIF", 2, CountIf);
     //COVAR	Returns covariance, the average of the products of paired deviations
     //CRITBINOM	Returns the smallest value for which the cumulative binomial distribution is less than or equal to a criterion value
     //DEVSQ	Returns the sum of squares of deviations
     //EXPONDIST	Returns the exponential distribution
     //FDIST	Returns the F probability distribution
     //FINV	Returns the inverse of the F probability distribution
     //FISHER	Returns the Fisher transformation
     //FISHERINV	Returns the inverse of the Fisher transformation
     //FORECAST	Returns a value along a linear trend
     //FREQUENCY	Returns a frequency distribution as a vertical array
     //FTEST	Returns the result of an F-test
     //GAMMADIST	Returns the gamma distribution
     //GAMMAINV	Returns the inverse of the gamma cumulative distribution
     //GAMMALN	Returns the natural logarithm of the gamma function, Γ(x)
     //GEOMEAN	Returns the geometric mean
     //GROWTH	Returns values along an exponential trend
     //HARMEAN	Returns the harmonic mean
     //HYPGEOMDIST	Returns the hypergeometric distribution
     //INTERCEPT	Returns the intercept of the linear regression line
     //KURT	Returns the kurtosis of a data set
     //LARGE	Returns the k-th largest value in a data set
     //LINEST	Returns the parameters of a linear trend
     //LOGEST	Returns the parameters of an exponential trend
     //LOGINV	Returns the inverse of the lognormal distribution
     //LOGNORMDIST	Returns the cumulative lognormal distribution
     ce.RegisterFunction("MAX", 1, int.MaxValue, Max);
     ce.RegisterFunction("MAXA", 1, int.MaxValue, MaxA);
     //MEDIAN	Returns the median of the given numbers
     ce.RegisterFunction("MIN", 1, int.MaxValue, Min);
     ce.RegisterFunction("MINA", 1, int.MaxValue, MinA);
     //MODE	Returns the most common value in a data set
     //NEGBINOMDIST	Returns the negative binomial distribution
     //NORMDIST	Returns the normal cumulative distribution
     //NORMINV	Returns the inverse of the normal cumulative distribution
     //NORMSDIST	Returns the standard normal cumulative distribution
     //NORMSINV	Returns the inverse of the standard normal cumulative distribution
     //PEARSON	Returns the Pearson product moment correlation coefficient
     //PERCENTILE	Returns the k-th percentile of values in a range
     //PERCENTRANK	Returns the percentage rank of a value in a data set
     //PERMUT	Returns the number of permutations for a given number of objects
     //POISSON	Returns the Poisson distribution
     //PROB	Returns the probability that values in a range are between two limits
     //QUARTILE	Returns the quartile of a data set
     //RANK	Returns the rank of a number in a list of numbers
     //RSQ	Returns the square of the Pearson product moment correlation coefficient
     //SKEW	Returns the skewness of a distribution
     //SLOPE	Returns the slope of the linear regression line
     //SMALL	Returns the k-th smallest value in a data set
     //STANDARDIZE	Returns a normalized value
     ce.RegisterFunction("STDEV", 1, int.MaxValue, StDev);
     ce.RegisterFunction("STDEVA", 1, int.MaxValue, StDevA);
     ce.RegisterFunction("STDEVP", 1, int.MaxValue, StDevP);
     ce.RegisterFunction("STDEVPA", 1, int.MaxValue, StDevPA);
     ce.RegisterFunction("STDEV.S", 1, int.MaxValue, StDev);
     ce.RegisterFunction("STDEV.P", 1, int.MaxValue, StDevP);
     //STEYX	Returns the standard error of the predicted y-value for each x in the regression
     //TDIST	Returns the Student's t-distribution
     //TINV	Returns the inverse of the Student's t-distribution
     //TREND	Returns values along a linear trend
     //TRIMMEAN	Returns the mean of the interior of a data set
     //TTEST	Returns the probability associated with a Student's t-test
     ce.RegisterFunction("VAR", 1, int.MaxValue, Var);
     ce.RegisterFunction("VARA", 1, int.MaxValue, VarA);
     ce.RegisterFunction("VARP", 1, int.MaxValue, VarP);
     ce.RegisterFunction("VARPA", 1, int.MaxValue, VarPA);
     ce.RegisterFunction("VAR.S", 1, int.MaxValue, Var);
     ce.RegisterFunction("VAR.P", 1, int.MaxValue, VarP);
     //WEIBULL	Returns the Weibull distribution
     //ZTEST	Returns the one-tailed probability-value of a z-test
 }