001 /* 002 // This software is subject to the terms of the Common Public License 003 // Agreement, available at the following URL: 004 // http://www.opensource.org/licenses/cpl.html. 005 // Copyright (C) 2008-2008 Julian Hyde 006 // All Rights Reserved. 007 // You must accept the terms of that agreement to use this software. 008 */ 009 package mondrian.olap.fun.vba; 010 011 import static mondrian.olap.fun.JavaFunDef.Description; 012 import static mondrian.olap.fun.JavaFunDef.FunctionName; 013 import mondrian.olap.fun.JavaFunDef; 014 015 /** 016 * Implementations of functions in the Excel worksheet library. 017 * 018 * <p>Functions are loaded into the function table by reflection. 019 * 020 * @author jhyde 021 * @version $Id: //open/mondrian/src/main/mondrian/olap/fun/vba/Excel.java#3 $ 022 * @since Dec 31, 2007 023 */ 024 public abstract class Excel { 025 // There follows a list of all functions defined in Excel. Functions are 026 // marked 'todo:' if they still need to be implemented; 'skip:' if they 027 // are implemented elsewhere, such as in Vba or there there is an explicit 028 // implementation of FunDef for them. A FunDef typically allows a more 029 // efficient implementation. 030 031 // AccrInt Returns the accrued interest for a security that pays periodic interest. 032 // AccrIntM Returns the accrued interest for a security that pays interest at maturity. 033 034 @FunctionName("Acos") 035 @JavaFunDef.Signature("Acos(number)") 036 @Description("Returns the arccosine, or inverse cosine, of a number. The arccosine is the angle whose cosine is Arg1. The returned angle is given in radians in the range 0 (zero) to pi.") 037 public static double acos(double number) { 038 return Math.acos(number); 039 } 040 041 @FunctionName("Acosh") 042 @JavaFunDef.Signature("Acosh(number)") 043 @Description("Returns the inverse hyperbolic cosine of a number. Number must be greater than or equal to 1. The inverse hyperbolic cosine is the value whose hyperbolic cosine is Arg1, so Acosh(Cosh(number)) equals Arg1.") 044 public static double acosh(double x) { 045 return Math.log(x + Math.sqrt((x * x) - 1.0)); 046 } 047 048 // Todo: AmorDegrc Returns the depreciation for each accounting period. This function is provided for the French accounting system. 049 // Todo: AmorLinc Returns the depreciation for each accounting period. This function is provided for the French accounting system. 050 051 // Skip: And Returns TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE. 052 053 // Todo: Asc For Double-byte character set (DBCS) languages, changes full-width (double-byte) characters to half-width (single-byte) characters. 054 055 @FunctionName("Asin") 056 @JavaFunDef.Signature("Asin(number)") 057 @Description("Returns the arcsine, or inverse sine, of a number. The arcsine is the angle whose sine is Arg1. The returned angle is given in radians in the range -pi/2 to pi/2.") 058 public static double asin(double number) { 059 return Math.asin(number); 060 } 061 062 @FunctionName("Asinh") 063 @JavaFunDef.Signature("Asinh(number)") 064 @Description("Returns the inverse hyperbolic sine of a number. The inverse hyperbolic sine is the value whose hyperbolic sine is Arg1, so Asinh(Sinh(number)) equals Arg1.") 065 public static double asinh(double x) { 066 return Math.log(x + Math.sqrt(1.0 + (x * x))); 067 } 068 069 @FunctionName("Atan2") 070 @JavaFunDef.Signature("Atan2(x, y)") 071 @Description("Returns the arctangent, or inverse tangent, of the specified x- and y-coordinates. The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a point with coordinates (x_num, y_num). The angle is given in radians between -pi and pi, excluding -pi.") 072 public static double atan2(double y, double x) { 073 return Math.atan2(y, x); 074 } 075 076 @FunctionName("Atanh") 077 @JavaFunDef.Signature("Atanh(number)") 078 @Description("Returns the inverse hyperbolic tangent of a number. Number must be between -1 and 1 (excluding -1 and 1).") 079 public static double atanh(double x) { 080 return .5 * Math.log((1.0 + x) / (1.0 - x)); 081 } 082 083 // Todo: AveDev Returns the average of the absolute deviations of data points from their mean. AveDev is a measure of the variability in a data set. 084 // Todo: Average Returns the average (arithmetic mean) of the arguments. 085 // Todo: AverageIf Returns the average (arithmetic mean) of all the cells in a range that meet a given criteria. 086 // Todo: AverageIfs Returns the average (arithmetic mean) of all cells that meet multiple criteria. 087 // Todo: BahtText Converts a number to Thai text and adds a suffix of "Baht." 088 // Todo: BesselI Returns the modified Bessel function, which is equivalent to the Bessel function evaluated for purely imaginary arguments. 089 // Todo: BesselJ Returns the Bessel function. 090 // Todo: BesselK Returns the modified Bessel function, which is equivalent to the Bessel functions evaluated for purely imaginary arguments. 091 // Todo: BesselY Returns the Bessel function, which is also called the Weber function or the Neumann function. 092 // Todo: BetaDist Returns the beta cumulative distribution function. 093 // Todo: BetaInv Returns the inverse of the cumulative distribution function for a specified beta distribution. That is, if probability = BetaDist(x,...), then BetaInv(probability,...) = x. 094 // Todo: Bin2Dec Converts a binary number to decimal. 095 // Todo: Bin2Hex Converts a binary number to hexadecimal. 096 // Todo: Bin2Oct Converts a binary number to octal. 097 // Todo: BinomDist Returns the individual term binomial distribution probability. 098 // Todo: Ceiling Returns number rounded up, away from zero, to the nearest multiple of significance. 099 // Todo: ChiDist Returns the one-tailed probability of the chi-squared distribution. 100 // Todo: ChiInv Returns the inverse of the one-tailed probability of the chi-squared distribution. 101 // Todo: ChiTest Returns the test for independence. 102 // Todo: Choose Uses Arg1 as the index to return a value from the list of value arguments. 103 // Todo: Clean Removes all nonprintable characters from text. 104 // Todo: Combin Returns the number of combinations for a given number of items. Use Combin to determine the total possible number of groups for a given number of items. 105 // Todo: Complex Converts real and imaginary coefficients into a complex number of the form x + yi or x + yj. 106 // Todo: Confidence Returns a value that you can use to construct a confidence interval for a population mean. 107 // Todo: Convert Converts a number from one measurement system to another. For example, Convert can translate a table of distances in miles to a table of distances in kilometers. 108 // Todo: Correl Returns the correlation coefficient of the Arg1 and Arg2 cell ranges. 109 110 @FunctionName("Cosh") 111 @Description("Returns the hyperbolic cosine of a number.") 112 public static double cosh(double number) { 113 return Math.cosh(number); 114 } 115 116 // Todo: Count Counts the number of cells that contain numbers and counts numbers within the list of arguments. 117 // Todo: CountA Counts the number of cells that are not empty and the values within the list of arguments. 118 // Todo: CountBlank Counts empty cells in a specified range of cells. 119 // Todo: CountIf Counts the number of cells within a range that meet the given criteria. 120 // Todo: CountIfs Counts the number of cells within a range that meet multiple criteria. 121 // Todo: CoupDayBs Returns the number of days from the beginning of the coupon period to the settlement date. 122 // Todo: CoupDays Returns the number of days in the coupon period that contains the settlement date. 123 // Todo: CoupDaysNc Returns the number of days from the settlement date to the next coupon date. 124 // Todo: CoupNcd Returns a number that represents the next coupon date after the settlement date. 125 // Todo: CoupNum Returns the number of coupons payable between the settlement date and maturity date, rounded up to the nearest whole coupon. 126 // Todo: CoupPcd The description for this item will appear in the final release of Office 2007. 127 // Todo: Covar Returns covariance, the average of the products of deviations for each data point pair. 128 // Todo: CritBinom Returns the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value. 129 // Todo: CumIPmt Returns the cumulative interest paid on a loan between start_period and end_period. 130 // Todo: CumPrinc Returns the cumulative principal paid on a loan between start_period and end_period. 131 // Todo: DAverage Averages the values in a column of a list or database that match conditions you specify. 132 // Todo: Days360 Returns the number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations. 133 // Todo: Db Returns the depreciation of an asset for a specified period using the fixed-declining balance method. 134 // Todo: Dbcs The description for this item will appear in the final release of Office 2007. 135 // Todo: DCount Counts the cells that contain numbers in a column of a list or database that match conditions that you specify. 136 // Todo: DCountA Counts the nonblank cells in a column of a list or database that match conditions that you specify. 137 // Todo: Ddb Returns the depreciation of an asset for a specified period using the double-declining balance method or some other method you specify. 138 // Todo: Dec2Bin Converts a decimal number to binary. 139 // Todo: Dec2Hex Converts a decimal number to hexadecimal. 140 // Todo: Dec2Oct Converts a decimal number to octal. 141 // Todo: Degrees Converts radians into degrees. 142 143 @FunctionName("Degrees") 144 @Description("Converts radians to degrees.") 145 public static double degrees(double number) { 146 // 180 degrees = Pi radians 147 return number * 180.0 / Math.PI; 148 } 149 150 // Todo: Delta Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise. 151 // Todo: DevSq Returns the sum of squares of deviations of data points from their sample mean. 152 // Todo: DGet Extracts a single value from a column of a list or database that matches conditions that you specify. 153 // Todo: Disc Returns the discount rate for a security. 154 // Todo: DMax Returns the largest number in a column of a list or database that matches conditions you that specify. 155 // Todo: DMin Returns the smallest number in a column of a list or database that matches conditions that you specify. 156 // Todo: Dollar The function described in this Help topic converts a number to text format and applies a currency symbol. The name of the function (and the symbol that it applies) depends upon your language settings. 157 // Todo: DollarDe Converts a dollar price expressed as a fraction into a dollar price expressed as a decimal number. Use DOLLARDE to convert fractional dollar numbers, such as securities prices, to decimal numbers. 158 // Todo: DollarFr Converts a dollar price expressed as a decimal number into a dollar price expressed as a fraction. Use DOLLARFR to convert decimal numbers to fractional dollar numbers, such as securities prices. 159 // Todo: DProduct Multiplies the values in a column of a list or database that match conditions that you specify. 160 // Todo: DStDev Estimates the standard deviation of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify. 161 // Todo: DStDevP Calculates the standard deviation of a population based on the entire population by using the numbers in a column of a list or database that match conditions that you specify. 162 // Todo: DSum Adds the numbers in a column of a list or database that match conditions that you specify. 163 // Todo: Duration Returns the Macauley duration for an assumed par value of $100. Duration is defined as the weighted average of the present value of the cash flows and is used as a measure of a bond price's response to changes in yield. 164 // Todo: DVar Estimates the variance of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify. 165 // Todo: DVarP Calculates the variance of a population based on the entire population by using the numbers in a column of a list or database that match conditions that you specify. 166 // Todo: EDate Returns the serial number that represents the date that is the indicated number of months before or after a specified date (the start_date). Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue. 167 // Todo: Effect Returns the effective annual interest rate, given the nominal annual interest rate and the number of compounding periods per year. 168 // Todo: EoMonth Returns the serial number for the last day of the month that is the indicated number of months before or after start_date. Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month. 169 // Todo: Erf Returns the error function integrated between lower_limit and upper_limit. 170 // Todo: ErfC The description for this item will appear in the final release of Office 2007. 171 // Todo: Even Returns number rounded up to the nearest even integer. You can use this function for processing items that come in twos. For example, a packing crate accepts rows of one or two items. The crate is full when the number of items, rounded up to the nearest two, matches the crate's capacity. 172 // Todo: ExponDist Returns the exponential distribution. Use EXPONDIST to model the time between events, such as how long an automated bank teller takes to deliver cash. For example, you can use EXPONDIST to determine the probability that the process takes at most 1 minute. 173 // Todo: Fact Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...* number. 174 // Todo: FactDouble Returns the double factorial of a number. 175 // Todo: FDist Returns the F probability distribution. You can use this function to determine whether two data sets have different degrees of diversity. For example, you can examine the test scores of men and women entering high school and determine if the variability in the females is different from that found in the males. 176 // Todo: Find Finds specific information in a worksheet. 177 // Todo: FindB FIND and FINDB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string. 178 // Todo: FInv Returns the inverse of the F probability distribution. If p = FDIST(x,...), then FINV(p,...) = x. 179 // Todo: Fisher Returns the Fisher transformation at x. This transformation produces a function that is normally distributed rather than skewed. Use this function to perform hypothesis testing on the correlation coefficient. 180 // Todo: FisherInv Returns the inverse of the Fisher transformation. Use this transformation when analyzing correlations between ranges or arrays of data. If y = FISHER(x), then FISHERINV(y) = x. 181 // Todo: Fixed Rounds a number to the specified number of decimals, formats the number in decimal format using a period and commas, and returns the result as text. 182 // Todo: Floor Rounds number down, toward zero, to the nearest multiple of significance. 183 // Todo: Forecast Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value. The known values are existing x-values and y-values, and the new value is predicted by using linear regression. You can use this function to predict future sales, inventory requirements, or consumer trends. 184 // Todo: Frequency Calculates how often values occur within a range of values, and then returns a vertical array of numbers. For example, use FREQUENCY to count the number of test scores that fall within ranges of scores. Because FREQUENCY returns an array, it must be entered as an array formula. 185 // Todo: FTest Returns the result of an F-test. An F-test returns the two-tailed probability that the variances in array1 and array2 are not significantly different. Use this function to determine whether two samples have different variances. For example, given test scores from public and private schools, you can test whether these schools have different levels of test score diversity. 186 // Todo: Fv Returns the future value of an investment based on periodic, constant payments and a constant interest rate. 187 // Todo: FVSchedule Returns the future value of an initial principal after applying a series of compound interest rates. Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate. 188 // Todo: GammaDist Returns the gamma distribution. You can use this function to study variables that may have a skewed distribution. The gamma distribution is commonly used in queuing analysis. 189 // Todo: GammaInv Returns the inverse of the gamma cumulative distribution. If p = GAMMADIST(x,...), then GAMMAINV(p,...) = x. 190 // Todo: GammaLn Returns the natural logarithm of the gamma function, ?(x). 191 // Todo: Gcd Returns the greatest common divisor of two or more integers. The greatest common divisor is the largest integer that divides both number1 and number2 without a remainder. 192 // Todo: GeoMean Returns the geometric mean of an array or range of positive data. For example, you can use GEOMEAN to calculate average growth rate given compound interest with variable rates. 193 // Todo: GeStep Returns 1 if number ? step; returns 0 (zero) otherwise. Use this function to filter a set of values. For example, by summing several GESTEP functions you calculate the count of values that exceed a threshold. 194 // Todo: Growth Calculates predicted exponential growth by using existing data. GROWTH returns the y-values for a series of new x-values that you specify by using existing x-values and y-values. You can also use the GROWTH worksheet function to fit an exponential curve to existing x-values and y-values. 195 // Todo: HarMean Returns the harmonic mean of a data set. The harmonic mean is the reciprocal of the arithmetic mean of reciprocals. 196 // Todo: Hex2Bin Converts a hexadecimal number to binary. 197 // Todo: Hex2Dec Converts a hexadecimal number to decimal. 198 // Todo: Hex2Oct Converts a hexadecimal number to octal. 199 // Todo: HLookup Searches for a value in the top row of a table or an array of values, and then returns a value in the same column from a row you specify in the table or array. Use HLOOKUP when your comparison values are located in a row across the top of a table of data, and you want to look down a specified number of rows. Use VLOOKUP when your comparison values are located in a column to the left of the data you want to find. 200 // Todo: HypGeomDist Returns the hypergeometric distribution. HYPGEOMDIST returns the probability of a given number of sample successes, given the sample size, population successes, and population size. Use HYPGEOMDIST for problems with a finite population, where each observation is either a success or a failure, and where each subset of a given size is chosen with equal likelihood. 201 // Todo: IfError Returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula. Use the IFERROR function to trap and handle errors in a formula. 202 // Todo: ImAbs Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format. 203 // Todo: Imaginary Returns the imaginary coefficient of a complex number in x + yi or x + yj text format. 204 // Todo: ImArgument Returns the argument (theta), an angle expressed in radians, such that: 205 // Todo: ImConjugate Returns the complex conjugate of a complex number in x + yi or x + yj text format. 206 // Todo: ImCos Returns the cosine of a complex number in x + yi or x + yj text format. 207 // Todo: ImDiv Returns the quotient of two complex numbers in x + yi or x + yj text format. 208 // Todo: ImExp Returns the exponential of a complex number in x + yi or x + yj text format. 209 // Todo: ImLn Returns the natural logarithm of a complex number in x + yi or x + yj text format. 210 // Todo: ImLog10 Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format. 211 // Todo: ImLog2 Returns the base-2 logarithm of a complex number in x + yi or x + yj text format. 212 // Todo: ImPower Returns a complex number in x + yi or x + yj text format raised to a power. 213 // Todo: ImProduct Returns the product of 2 to 29 complex numbers in x + yi or x + yj text format. 214 // Todo: ImReal Returns the real coefficient of a complex number in x + yi or x + yj text format. 215 // Todo: ImSin Returns the sine of a complex number in x + yi or x + yj text format. 216 // Todo: ImSqrt Returns the square root of a complex number in x + yi or x + yj text format. 217 // Todo: ImSub Returns the difference of two complex numbers in x + yi or x + yj text format. 218 // Todo: ImSum Returns the sum of two or more complex numbers in x + yi or x + yj text format. 219 // Todo: Index Returns a value or the reference to a value from within a table or range. There are two forms of the INDEX function: the array form and the reference form. 220 // Todo: Intercept Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values. The intercept point is based on a best-fit regression line plotted through the known x-values and known y-values. Use the INTERCEPT function when you want to determine the value of the dependent variable when the independent variable is 0 (zero). For example, you can use the INTERCEPT function to predict a metal's electrical resistance at 0C when your data points were taken at room temperature and higher. 221 // Todo: IntRate Returns the interest rate for a fully invested security. 222 // Todo: Ipmt Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate. 223 // Todo: Irr Returns the internal rate of return for a series of cash flows represented by the numbers in values. These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received for an investment consisting of payments (negative values) and income (positive values) that occur at regular periods. 224 // Todo: IsErr Checks the type of value and returns TRUE or FALSE depending if the value refers to any error value except #N/A. 225 // Todo: IsError Checks the type of value and returns TRUE or FALSE depending if the value refers to any error value (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!). 226 // Todo: IsEven Checks the type of value and returns TRUE or FALSE depending if the value is even. 227 // Todo: IsLogical Checks the type of value and returns TRUE or FALSE depending if the value refers to a logical value. 228 // Todo: IsNA Checks the type of value and returns TRUE or FALSE depending if the value refers to the #N/A (value not available) error value. 229 // Todo: IsNonText Checks the type of value and returns TRUE or FALSE depending if the value refers to any item that is not text. (Note that this function returns TRUE if value refers to a blank cell.) 230 // Todo: IsNumber Checks the type of value and returns TRUE or FALSE depending if the value refers to a number. 231 // Todo: IsOdd Checks the type of value and returns TRUE or FALSE depending if the value is odd. 232 // Todo: Ispmt Calculates the interest paid during a specific period of an investment. This function is provided for compatibility with Lotus 1-2-3. 233 // Todo: IsText Checks the type of value and returns TRUE or FALSE depending if the value refers to text. 234 // Todo: Kurt Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness or flatness of a distribution compared with the normal distribution. Positive kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a relatively flat distribution. 235 // Todo: Large Returns the k-th largest value in a data set. You can use this function to select a value based on its relative standing. For example, you can use LARGE to return the highest, runner-up, or third-place score. 236 // Todo: Lcm Returns the least common multiple of integers. The least common multiple is the smallest positive integer that is a multiple of all integer arguments number1, number2, and so on. Use LCM to add fractions with different denominators. 237 // Todo: LinEst Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data, and returns an array that describes the line. Because this function returns an array of values, it must be entered as an array formula. 238 // Todo: Ln Returns the natural logarithm of a number. Natural logarithms are based on the constant e (2.71828182845904). 239 240 // See Vba 241 // Skip: Log Returns the logarithm of a number to the base you specify. 242 243 @FunctionName("Log10") 244 @Description("Returns the base-10 logarithm of a number.") 245 public static double log10(double number) { 246 return Math.log10(number); 247 } 248 249 // Todo: LogEst In regression analysis, calculates an exponential curve that fits your data and returns an array of values that describes the curve. Because this function returns an array of values, it must be entered as an array formula. 250 // Todo: LogInv Use the lognormal distribution to analyze logarithmically transformed data. 251 // Todo: LogNormDist Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed with parameters mean and standard_dev. Use this function to analyze data that has been logarithmically transformed. 252 // Todo: Lookup Returns a value either from a one-row or one-column range or from an array. The LOOKUP function has two syntax forms: the vector form and the array form. 253 // Todo: Match Returns the relative position of an item in an array that matches a specified value in a specified order. Use MATCH instead of one of the LOOKUP functions when you need the position of an item in a range instead of the item itself. 254 // Skip: Max Returns the largest value in a set of values. 255 // Todo: MDeterm Returns the matrix determinant of an array. 256 // Todo: MDuration Returns the modified Macauley duration for a security with an assumed par value of $100. 257 // Skip: Median Returns the median of the given numbers. The median is the number in the middle of a set of numbers. 258 // Skip: Min Returns the smallest number in a set of values. 259 // Todo: MInverse Returns the inverse matrix for the matrix stored in an array. 260 // Todo: MIrr Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both the cost of the investment and the interest received on reinvestment of cash. 261 // Todo: MMult Returns the matrix product of two arrays. The result is an array with the same number of rows as array1 and the same number of columns as array2. 262 // Todo: Mode Returns the most frequently occurring, or repetitive, value in an array or range of data. 263 // Todo: MRound Returns a number rounded to the desired multiple. 264 // Todo: MultiNomial Returns the ratio of the factorial of a sum of values to the product of factorials. 265 // Todo: NegBinomDist Returns the negative binomial distribution. NEGBINOMDIST returns the probability that there will be number_f failures before the number_s-th success, when the constant probability of a success is probability_s. This function is similar to the binomial distribution, except that the number of successes is fixed, and the number of trials is variable. Like the binomial, trials are assumed to be independent. 266 // Todo: NetworkDays Returns the number of whole working days between start_date and end_date. Working days exclude weekends and any dates identified in holidays. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term. 267 // Todo: Nominal Returns the nominal annual interest rate, given the effective rate and the number of compounding periods per year. 268 // Todo: NormDist Returns the normal distribution for the specified mean and standard deviation. This function has a very wide range of applications in statistics, including hypothesis testing. 269 // Todo: NormInv Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation. 270 // Todo: NormSDist Returns the standard normal cumulative distribution function. The distribution has a mean of 0 (zero) and a standard deviation of one. Use this function in place of a table of standard normal curve areas. 271 // Todo: NormSInv Returns the inverse of the standard normal cumulative distribution. The distribution has a mean of zero and a standard deviation of one. 272 // Todo: NPer Returns the number of periods for an investment based on periodic, constant payments and a constant interest rate. 273 // Todo: Npv Calculates the net present value of an investment by using a discount rate and a series of future payments (negative values) and income (positive values). 274 // Todo: Oct2Bin Converts an octal number to binary. 275 // Todo: Oct2Dec Converts an octal number to decimal. 276 // Todo: Oct2Hex Converts an octal number to hexadecimal. 277 // Todo: Odd Returns number rounded up to the nearest odd integer. 278 // Todo: OddFPrice Returns the price per $100 face value of a security having an odd (short or long) first period. 279 // Todo: OddFYield Returns the yield of a security that has an odd (short or long) first period. 280 // Todo: OddLPrice Returns the price per $100 face value of a security having an odd (short or long) last coupon period. 281 // Todo: OddLYield Returns the yield of a security that has an odd (short or long) last period. 282 // Skip: Or Returns TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE. 283 // Todo: Pearson Returns the Pearson product moment correlation coefficient, r, a dimensionless index that ranges from -1.0 to 1.0 inclusive and reflects the extent of a linear relationship between two data sets. 284 285 // We have a more efficient implementation of percentile 286 // Skip: Percentile Returns the k-th percentile of values in a range. You can use this function to establish a threshold of acceptance. For example, you can decide to examine candidates who score above the 90th percentile. 287 288 // Todo: PercentRank Returns the rank of a value in a data set as a percentage of the data set. This function can be used to evaluate the relative standing of a value within a data set. For example, you can use PERCENTRANK to evaluate the standing of an aptitude test score among all scores for the test. 289 // Todo: Permut Returns the number of permutations for a given number of objects that can be selected from number objects. A permutation is any set or subset of objects or events where internal order is significant. Permutations are different from combinations, for which the internal order is not significant. Use this function for lottery-style probability calculations. 290 // Todo: Phonetic Extracts the phonetic (furigana) characters from a text string. 291 292 @FunctionName("Pi") 293 @Description("Returns the number 3.14159265358979, the mathematical constant pi, accurate to 15 digits.") 294 public static double pi() { 295 return Math.PI; 296 } 297 298 // Todo: Pmt Calculates the payment for a loan based on constant payments and a constant interest rate. 299 // Todo: Poisson Returns the Poisson distribution. A common application of the Poisson distribution is predicting the number of events over a specific time, such as the number of cars arriving at a toll plaza in 1 minute. 300 301 @FunctionName("Power") 302 @Description("Returns the result of a number raised to a power.") 303 public static double power(double x, double y) { 304 return Math.pow(x, y); 305 } 306 307 // Todo: Ppmt Returns the payment on the principal for a given period for an investment based on periodic, constant payments and a constant interest rate. 308 // Todo: Price Returns the price per $100 face value of a security that pays periodic interest. 309 // Todo: PriceDisc Returns the price per $100 face value of a discounted security. 310 // Todo: PriceMat Returns the price per $100 face value of a security that pays interest at maturity. 311 // Todo: Prob Returns the probability that values in a range are between two limits. If upper_limit is not supplied, returns the probability that values in x_range are equal to lower_limit. 312 // Todo: Product Multiplies all the numbers given as arguments and returns the product. 313 // Todo: Proper Capitalizes the first letter in a text string and any other letters in text that follow any character other than a letter. Converts all other letters to lowercase letters. 314 // Todo: Pv Returns the present value of an investment. The present value is the total amount that a series of future payments is worth now. For example, when you borrow money, the loan amount is the present value to the lender. 315 // Todo: Quartile Returns the quartile of a data set. Quartiles often are used in sales and survey data to divide populations into groups. For example, you can use QUARTILE to find the top 25 percent of incomes in a population. 316 // Todo: Quotient Returns the integer portion of a division. Use this function when you want to discard the remainder of a division. 317 318 @FunctionName("Radians") 319 @Description("Converts degrees to radians.") 320 public static double radians(double number) { 321 // 180 degrees = Pi radians 322 return number / 180.0 * Math.PI; 323 } 324 325 // Todo: RandBetween Returns a random integer number between the numbers you specify. A new random integer number is returned every time the worksheet is calculated. 326 // Skip: Rank Returns the rank of a number in a list of numbers. The rank of a number is its size relative to other values in a list. (If you were to sort the list, the rank of the number would be its position.) 327 // Todo: Rate Returns the interest rate per period of an annuity. RATE is calculated by iteration and can have zero or more solutions. If the successive results of RATE do not converge to within 0.0000001 after 20 iterations, RATE returns the #NUM! error value. 328 // Todo: Received Returns the amount received at maturity for a fully invested security. 329 // Todo: Replace Replaces part of a text string, based on the number of characters you specify, with a different text string. 330 // Todo: ReplaceB REPLACEB replaces part of a text string, based on the number of bytes you specify, with a different text string. 331 // Todo: Rept Repeats text a given number of times. Use REPT to fill a cell with a number of instances of a text string. 332 // Todo: Roman Converts an arabic numeral to roman, as text. 333 // Todo: Round Rounds a number to a specified number of digits. 334 // Todo: RoundDown Rounds a number down, toward zero. 335 // Todo: RoundUp Rounds a number up, away from 0 (zero). 336 // Todo: RSq Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's. For more information, see PEARSON. The r-squared value can be interpreted as the proportion of the variance in y attributable to the variance in x. 337 // Todo: RTD This method connects to a source to receive real-time data. 338 // Todo: Search SEARCH and SEARCHB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string. 339 // Todo: SearchB SEARCH and SEARCHB locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string. 340 // Todo: SeriesSum Returns the sum of a power series based on the formula: 341 // Todo: Sinh Returns the hyperbolic sine of a number. 342 343 @FunctionName("Sinh") 344 @Description("Returns the hyperbolic sine of a number.") 345 public static double sinh(double number) { 346 return Math.sinh(number); 347 } 348 349 // Todo: Skew Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending toward more positive values. Negative skewness indicates a distribution with an asymmetric tail extending toward more negative values. 350 // Todo: Sln Returns the straight-line depreciation of an asset for one period. 351 // Todo: Slope Returns the slope of the linear regression line through data points in known_y's and known_x's. The slope is the vertical distance divided by the horizontal distance between any two points on the line, which is the rate of change along the regression line. 352 // Todo: Small Returns the k-th smallest value in a data set. Use this function to return values with a particular relative standing in a data set. 353 354 @FunctionName("SqrtPi") 355 @Description("Returns the square root of (number * pi).") 356 public static double sqrtPi(double number) { 357 return Math.sqrt(number * Math.PI); 358 } 359 360 // Todo: Standardize Returns a normalized value from a distribution characterized by mean and standard_dev. 361 // Todo: StDev Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean). 362 // Todo: StDevP Calculates standard deviation based on the entire population given as arguments. The standard deviation is a measure of how widely values are dispersed from the average value (the mean). 363 // Todo: StEyx Returns the standard error of the predicted y-value for each x in the regression. The standard error is a measure of the amount of error in the prediction of y for an individual x. 364 // Todo: Substitute Substitutes new_text for old_text in a text string. Use SUBSTITUTE when you want to replace specific text in a text string; use REPLACE when you want to replace any text that occurs in a specific location in a text string. 365 // Todo: Subtotal Creates subtotals. 366 // Todo: Sum Adds all the numbers in a range of cells. 367 // Todo: SumIf Adds the cells specified by a given criteria. 368 // Todo: SumIfs Adds the cells in a range that meet multiple criteria. 369 // Todo: SumProduct Multiplies corresponding components in the given arrays, and returns the sum of those products. 370 // Todo: SumSq Returns the sum of the squares of the arguments. 371 // Todo: SumX2MY2 Returns the sum of the difference of squares of corresponding values in two arrays. 372 // Todo: SumX2PY2 Returns the sum of the sum of squares of corresponding values in two arrays. The sum of the sum of squares is a common term in many statistical calculations. 373 // Todo: SumXMY2 Returns the sum of squares of differences of corresponding values in two arrays. 374 // Todo: Syd Returns the sum-of-years' digits depreciation of an asset for a specified period. 375 376 @FunctionName("Tanh") 377 @Description("Returns the hyperbolic tangent of a number.") 378 public static double tanh(double number) { 379 return Math.tanh(number); 380 } 381 382 // Todo: TBillEq Returns the bond-equivalent yield for a Treasury bill. 383 // Todo: TBillPrice Returns the price per $100 face value for a Treasury bill. 384 // Todo: TBillYield Returns the yield for a Treasury bill. 385 // Todo: TDist Returns the Percentage Points (probability) for the Student t-distribution where a numeric value (x) is a calculated value of t for which the Percentage Points are to be computed. The t-distribution is used in the hypothesis testing of small sample data sets. Use this function in place of a table of critical values for the t-distribution. 386 // Todo: Text Converts a value to text in a specific number format. 387 // Todo: TInv Returns the t-value of the Student's t-distribution as a function of the probability and the degrees of freedom. 388 // Todo: Transpose Returns a vertical range of cells as a horizontal range, or vice versa. TRANSPOSE must be entered as an array formula in a range that has the same number of rows and columns, respectively, as an array has columns and rows. Use TRANSPOSE to shift the vertical and horizontal orientation of an array on a worksheet. 389 // Todo: Trend Returns values along a linear trend. Fits a straight line (using the method of least squares) to the arrays known_y's and known_x's. Returns the y-values along that line for the array of new_x's that you specify. 390 // Todo: Trim Removes all spaces from text except for single spaces between words. Use TRIM on text that you have received from another application that may have irregular spacing. 391 // Todo: TrimMean Returns the mean of the interior of a data set. TRIMMEAN calculates the mean taken by excluding a percentage of data points from the top and bottom tails of a data set. You can use this function when you wish to exclude outlying data from your analysis. 392 // Todo: TTest Returns the probability associated with a Student's t-Test. Use TTEST to determine whether two samples are likely to have come from the same two underlying populations that have the same mean. 393 // Todo: USDollar The description for this item will appear in the final release of Office 2007. 394 // Todo: Var Estimates variance based on a sample. 395 // Todo: VarP Calculates variance based on the entire population. 396 // Todo: Vdb Returns the depreciation of an asset for any period you specify, including partial periods, using the double-declining balance method or some other method you specify. VDB stands for variable declining balance. 397 // Todo: VLookup Searches for a value in the first column of a table array and returns a value in the same row from another column in the table array. 398 // Todo: Weekday Returns the day of the week corresponding to a date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday), by default. 399 // Todo: WeekNum Returns a number that indicates where the week falls numerically within a year. 400 // Todo: Weibull Returns the Weibull distribution. Use this distribution in reliability analysis, such as calculating a device's mean time to failure. 401 // Todo: WorkDay Returns a number that represents a date that is the indicated number of working days before or after a date (the starting date). Working days exclude weekends and any dates identified as holidays. Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected delivery times, or the number of days of work performed. 402 // Todo: Xirr Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic. To calculate the internal rate of return for a series of periodic cash flows, use the IRR function. 403 // Todo: Xnpv The description for this item will appear in the final release of Office 2007. 404 // Todo: YearFrac Calculates the fraction of the year represented by the number of whole days between two dates (the start_date and the end_date). Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or obligations to assign to a specific term. 405 // Todo: YieldDisc Returns the annual yield for a discounted security. 406 // Todo: YieldMat Returns the annual yield of a security that pays interest at maturity. 407 // Todo: ZTest Returns the one-tailed probability-value of a z-test. For a given hypothesized population mean, ZTEST returns the probability that the sample mean would be greater than the average of observations in the data set (array) -- that is, the observed sample mean. 408 } 409 410 // End Excel.java