Difference between revisions of "FPSpreadsheet: List of formulas"
From Lazarus wiki
Jump to navigationJump to search (Complete section on statistical formulas) |
(Complete date/time formulas) |
||
Line 10: | Line 10: | ||
| colspan="5" | <b>Mathematical functions</b> | | colspan="5" | <b>Mathematical functions</b> | ||
|- | |- | ||
− | | <code>ABS(num)</code> || Returns the absolute value of a number || float | + | | <code>ABS(num)</code> || Returns the absolute value of a number || float || align="center" |1 || align="center" | float |
|- | |- | ||
− | | <code>ACOS(num)</code> || Returns the arccosine (in radians) of a number || float | + | | <code>ACOS(num)</code> || Returns the arccosine (in radians) of a number || float (>= -1 and <= +1)|| align="center" |1 || align="center" |float |
|- | |- | ||
− | | <code>ACOSH(num)</code> || Returns the inverse hyperbolic cosine of a number || float | + | | <code>ACOSH(num)</code> || Returns the inverse hyperbolic cosine of a number || float (>= 1) || align="center" |1 || align="center" |float |
|- | |- | ||
− | | <code>ASIN(num)</code> || Returns the arcsine (in radians) of a number || float | + | | <code>ASIN(num)</code> || Returns the arcsine (in radians) of a number || float (>= -1 and <= +1) || align="center" |1 || align="center" |float |
|- | |- | ||
− | | <code>ASINH(num)</code> || Returns the inverse hyperbolic sine of a number || float | + | | <code>ASINH(num)</code> || Returns the inverse hyperbolic sine of a number || float || align="center" |1 || align="center" |float |
|- | |- | ||
− | | <code>ATAN(num)</code> || Returns the arctangent (in radians) of a number || float | + | | <code>ATAN(num)</code> || Returns the arctangent (in radians) of a number || float || align="center" |1 || align="center" |float |
|- | |- | ||
− | | <code>ATANH(num)</code> || Returns the inverse hyperbolic tangent of a number || float | + | | <code>ATANH(num)</code> || Returns the inverse hyperbolic tangent of a number || float (> -1 and < +1) || align="center" |1 || align="center" |float |
|- | |- | ||
− | | <code>COS(num)</code> || Returns the cosine of an angle (in radians) || float | + | | <code>COS(num)</code> || Returns the cosine of an angle (in radians) || float || align="center" |1 || align="center" |float |
|- | |- | ||
− | | <code>COSH(num)</code> || Returns the hyperbolic cosine of a number || float | + | | <code>COSH(num)</code> || Returns the hyperbolic cosine of a number || float || align="center" |1 || align="center" |float |
|- | |- | ||
− | | <code>DEGREES(num)</code> || Converts an angle from radians to degrees || float | + | | <code>DEGREES(num)</code> || Converts an angle from radians to degrees || float || align="center" |1 || align="center" |float |
|- | |- | ||
− | | <code>EXP(num)</code> || Calculates the exponential function of a number || float | + | | <code>EXP(num)</code> || Calculates the exponential function of a number || float || align="center" |1 || align="center" |float |
|- | |- | ||
− | | <code>INT(num)</code> || Returns the integer portion of a number (like "floor()") || float | + | | <code>INT(num)</code> || Returns the integer portion of a number (like "floor()") || float || align="center" |1 || align="center" |integer |
|- | |- | ||
− | | <code>LN(num)</code> || Calculates the natural logarithm of a number || float | + | | <code>LN(num)</code> || Calculates the natural logarithm of a number || float (> 0) || align="center" |1 || align="center" |float |
|- | |- | ||
− | | <code>LOG(num [, base])</code> || Calculates the logarithm of a number to a specified base.<br> <code>base</code>, if omitted, is 10. || float | + | | <code>LOG(num [, base])</code> || Calculates the logarithm of a number to a specified base.<br> <code>base</code>, if omitted, is 10. || float (> 0) || align="center" |1 or 2 || align="center" |float |
|- | |- | ||
− | | <code>LOG10(num)</code> || Calculates the base-10 logarithm of a number || float | + | | <code>LOG10(num)</code> || Calculates the base-10 logarithm of a number || float (> 0) || align="center"|1 || align="center"|float |
|- | |- | ||
| <code>PI()</code> || Returns the mathematical constant π (3.14159265358979) || none || align="center"|0 || align="center"|float | | <code>PI()</code> || Returns the mathematical constant π (3.14159265358979) || none || align="center"|0 || align="center"|float | ||
|- | |- | ||
− | | <code>POWER(num, exponent)</code> || Returns the result of a number raised to a given power || float | + | | <code>POWER(num, exponent)</code> || Returns the result of a number raised to a given power || float || align="center"|2 || align="center"|float |
|- | |- | ||
− | | <code>RADIANS(num)</code> || Converts an angle from degrees to radians || float | + | | <code>RADIANS(num)</code> || Converts an angle from degrees to radians || float || align="center"|1 or 2 || align="center"|float |
|- | |- | ||
| <code>RAND()</code> || Returns a random number between 0 and 1 || none || align="center"|0 || align="center"|float | | <code>RAND()</code> || Returns a random number between 0 and 1 || none || align="center"|0 || align="center"|float | ||
|- | |- | ||
− | | <code>ROUND(num, digits)</code> || Returns a number rounded to a specified number of digits || float | + | | <code>ROUND(num, digits)</code> || Returns a number rounded to a specified number of digits || float || align="center"|2 || align="center"|float |
|- | |- | ||
− | | <code>SIGN(num)</code> || Returns the sign of a number || float | + | | <code>SIGN(num)</code> || Returns the sign of a number || float || align="center"|1 || align="center"|integer |
|- | |- | ||
− | | <code>SIN(num)</code> || Returns the sine of an angle (in radians) || float | + | | <code>SIN(num)</code> || Returns the sine of an angle (in radians) || float || align="center"|1 || align="center"|float |
|- | |- | ||
− | | <code>SINH(num)</code> || Returns the hyperbolic sine of a number || float | + | | <code>SINH(num)</code> || Returns the hyperbolic sine of a number || float || align="center"|1 || align="center"|float |
|- | |- | ||
− | | <code>TAN(num)</code> || Returns the tangent of an angle (in radians) || float | + | | <code>TAN(num)</code> || Returns the tangent of an angle (in radians) || float ( <> k*π/2) || align="center"|1 || align="center"|float |
|- | |- | ||
− | | <code>TANH(num)</code> || Returns the hyperbolic tangent of a number || float | + | | <code>TANH(num)</code> || Returns the hyperbolic tangent of a number || float || align="center"|1 || align="center"|float |
|- | |- | ||
Line 64: | Line 64: | ||
| colspan="5" | <b>Statistical functions</b> | | colspan="5" | <b>Statistical functions</b> | ||
|- | |- | ||
− | | <code>AVEDEV(num1 [, num2, ...] )</code> || Average value of absolute deviations of data from their mean. || float | + | | <code>AVEDEV(num1 [, num2, ...] )</code> || Average value of absolute deviations of data from their mean. || float || align="center"|> 1 || align="center" | float |
|- | |- | ||
− | | <code>AVERAGE(num1 [, num2, ...] )</code> || Average value of a series of numbers || float | + | | <code>AVERAGE(num1 [, num2, ...] )</code> || Average value of a series of numbers || float || align="center"|> 1 || align="center" | float |
|- | |- | ||
− | | <code>COUNT(value1 [, value2, ...] )</code> || Counts cells and arguments containing numbers || any || align="center" | | + | | <code>COUNT(value1 [, value2, ...] )</code> || Counts cells and arguments containing numbers || any || align="center"|> 1 || align="center" | integer |
|- | |- | ||
− | | <code>COUNTA(value1 [, value2, ...] )</code> || Counts the number of non-empty cells and arguments || any || align="center" | | + | | <code>COUNTA(value1 [, value2, ...] )</code> || Counts the number of non-empty cells and arguments || any || align="center"|> 1 || align="center" | integer |
|- | |- | ||
− | | <code>COUNTBLANK(range)</code> || Counts the number of empty cells in a range || any || align="center" | | + | | <code>COUNTBLANK(range)</code> || Counts the number of empty cells in a range || any || align="center"|1 || align="center"|cell range<br>(like A1:D5) |
|- | |- | ||
− | | <code>MAX(num1 [, num2, ...] )</code> || Returns the largest value from the numbers provided || float | + | | <code>MAX(num1 [, num2, ...] )</code> || Returns the largest value from the numbers provided || float || align="center"|> 1 || align="center" | float |
|- | |- | ||
− | | <code>MIN(num1 [, num2, ...] )</code> || Returns the smallest value from the numbers provided || float | + | | <code>MIN(num1 [, num2, ...] )</code> || Returns the smallest value from the numbers provided || float || align="center"|> 1 || align="center" | float |
|- | |- | ||
− | | <code>PRODUCT(num1 [, num2, ...] )</code> || Calculates the product of the numbers provided || float | + | | <code>PRODUCT(num1 [, num2, ...] )</code> || Calculates the product of the numbers provided || float || align="center"|> 1 || align="center" | float |
|- | |- | ||
− | | <code>STDEV(num1 [, num2, ...] )</code> || Returns the standard deviation of a population based on a ample of numbers || float | + | | <code>STDEV(num1 [, num2, ...] )</code> || Returns the standard deviation of a population based on a ample of numbers || float || align="center"|> 1 || align="center" | float |
|- | |- | ||
− | | <code>STDEVP(num1 [, num2, ...] )</code> || Returns the standard deviation of a population based on an entire population || float | + | | <code>STDEVP(num1 [, num2, ...] )</code> || Returns the standard deviation of a population based on an entire population || float || align="center"|> 1 || align="center" | float |
|- | |- | ||
− | | <code>SUM(num1 [, num2, ...] )</code> || Calculates the sum of the numbers provided || float | + | | <code>SUM(num1 [, num2, ...] )</code> || Calculates the sum of the numbers provided || float || align="center"|> 1 || align="center" | float |
|- | |- | ||
− | | <code>SUMSQ(num1 [, num2, ...] )</code> || Returns the sum of the squares of a series of numbers || float | + | | <code>SUMSQ(num1 [, num2, ...] )</code> || Returns the sum of the squares of a series of numbers || float || align="center"|> 1 || align="center" | float |
|- | |- | ||
− | | <code>VAR(num1 [, num2, ...] )</code> || Returns the variance of a population based on a ample of numbers || float | + | | <code>VAR(num1 [, num2, ...] )</code> || Returns the variance of a population based on a ample of numbers || float || align="center"|>1 || align="center" | float |
|- | |- | ||
− | | <code>VARP(num1 [, num2, ...] )</code> || Returns the variance of a population based on an entire population || float | + | | <code>VARP(num1 [, num2, ...] )</code> || Returns the variance of a population based on an entire population || float || align="center"|> 1 || align="center" | float |
|- | |- | ||
Line 96: | Line 96: | ||
| colspan="5" | <b>Date/time functions</b> | | colspan="5" | <b>Date/time functions</b> | ||
|- | |- | ||
− | | <code>DATE(year, month, day)</code> || Calculates a serial date number from year, month and day || integer | + | | <code>DATE(year, month, day)</code> || Calculates a serial date number from year, month and day || integer || align="center" |3 || align="center" | date/time |
|- | |- | ||
+ | | <code>DATEDIF(start_date, end_date, interval)</code> || Calculates the difference between two date value based on a given interval || <code>start_date, end_date</code>: date/time<br> <code>interval</code> is a string:<br>"Y" = number of years, <br>"M" = number of months, <br>"D" = number of days || align="center" |3 || align="center" | integer | ||
+ | |- | ||
+ | | <code>DATEVALUE(date_string)</code> || Converts a (date) string to a date/time value. || string || align="center"|1 || align="center" | date/time | ||
+ | |- | ||
+ | | <code>DAY(value)</code> || Extracts the day number (1..31) of a date value. || date/time, number, string || align="center"|1 || align="center" | integer | ||
+ | |- | ||
+ | | <code>HOUR(value)</code> || Extracts the hour (0..23) of a time value. || date/time, number, string || align="center"|1 || align="center" | integer | ||
+ | |- | ||
+ | | <code>MINUTE(value)</code> || Extracts the minute (0..59) of a time value. || date/time, number, string || align="center"|1 || align="center" | integer | ||
+ | |- | ||
+ | | <code>MONTH(value)</code> || Extracts the month number (1..12) of a date value. || date/time, number, string || align="center"|1 || align="center" | integer | ||
+ | |- | ||
+ | | <code>NOW()</code> || Returns the current system date and time. <br> Will refresh whenever the worksheet recalculates. || none || align="center"|0 || align="center" | date/time | ||
+ | |- | ||
+ | | <code>SECOND(value)</code> || Extracts the second (0..59) of a time value. || date/time, number, string || align="center"|1 || align="center" | integer | ||
+ | |- | ||
+ | | <code>TIME(year, month, day)</code> || Calculates a date/time value from hours, minutes and seconds || integer || align="center" |3 || align="center" | date/time | ||
+ | |- | ||
+ | | <code>TIMEVALUE(time_string)</code> || Converts a (time) string to a date/time value. || string || align="center"|1 || align="center" | date/time | ||
+ | |- | ||
+ | | <code>TODAY()</code> || Returns the current system date || none || align="center"|0 || align="center" | date/time | ||
+ | |- | ||
+ | | <code>WEEKDAY(value [, type])</code> || Returns a number code for the weekday of a date || <code>value</code>: date/time, number, string <br> <code>type=0</code>: Sunday=1, Saturday=7 (default)<br><code>type=1</code>: Monday=1, Sunday=7<br><code>type=2</code>: Monday=9, Sunday=6 || align="center"|1 or 2 || align="center" | integer | ||
+ | |- | ||
+ | | <code>YEAR(value)</code> || Extracts the year of a date value. || date/time, number, string || align="center"|1 || align="center" | integer | ||
+ | |- | ||
+ | |||
Revision as of 11:00, 31 August 2014
This is a list of the formulas supported by FPSpreadsheet:
Calling prototye | Meaning | Argument types | Arguments | Result type |
---|---|---|---|---|
Mathematical functions | ||||
ABS(num) |
Returns the absolute value of a number | float | 1 | float |
ACOS(num) |
Returns the arccosine (in radians) of a number | float (>= -1 and <= +1) | 1 | float |
ACOSH(num) |
Returns the inverse hyperbolic cosine of a number | float (>= 1) | 1 | float |
ASIN(num) |
Returns the arcsine (in radians) of a number | float (>= -1 and <= +1) | 1 | float |
ASINH(num) |
Returns the inverse hyperbolic sine of a number | float | 1 | float |
ATAN(num) |
Returns the arctangent (in radians) of a number | float | 1 | float |
ATANH(num) |
Returns the inverse hyperbolic tangent of a number | float (> -1 and < +1) | 1 | float |
COS(num) |
Returns the cosine of an angle (in radians) | float | 1 | float |
COSH(num) |
Returns the hyperbolic cosine of a number | float | 1 | float |
DEGREES(num) |
Converts an angle from radians to degrees | float | 1 | float |
EXP(num) |
Calculates the exponential function of a number | float | 1 | float |
INT(num) |
Returns the integer portion of a number (like "floor()") | float | 1 | integer |
LN(num) |
Calculates the natural logarithm of a number | float (> 0) | 1 | float |
LOG(num [, base]) |
Calculates the logarithm of a number to a specified base.base , if omitted, is 10. |
float (> 0) | 1 or 2 | float |
LOG10(num) |
Calculates the base-10 logarithm of a number | float (> 0) | 1 | float |
PI() |
Returns the mathematical constant π (3.14159265358979) | none | 0 | float |
POWER(num, exponent) |
Returns the result of a number raised to a given power | float | 2 | float |
RADIANS(num) |
Converts an angle from degrees to radians | float | 1 or 2 | float |
RAND() |
Returns a random number between 0 and 1 | none | 0 | float |
ROUND(num, digits) |
Returns a number rounded to a specified number of digits | float | 2 | float |
SIGN(num) |
Returns the sign of a number | float | 1 | integer |
SIN(num) |
Returns the sine of an angle (in radians) | float | 1 | float |
SINH(num) |
Returns the hyperbolic sine of a number | float | 1 | float |
TAN(num) |
Returns the tangent of an angle (in radians) | float ( <> k*π/2) | 1 | float |
TANH(num) |
Returns the hyperbolic tangent of a number | float | 1 | float |
Statistical functions | ||||
AVEDEV(num1 [, num2, ...] ) |
Average value of absolute deviations of data from their mean. | float | > 1 | float |
AVERAGE(num1 [, num2, ...] ) |
Average value of a series of numbers | float | > 1 | float |
COUNT(value1 [, value2, ...] ) |
Counts cells and arguments containing numbers | any | > 1 | integer |
COUNTA(value1 [, value2, ...] ) |
Counts the number of non-empty cells and arguments | any | > 1 | integer |
COUNTBLANK(range) |
Counts the number of empty cells in a range | any | 1 | cell range (like A1:D5) |
MAX(num1 [, num2, ...] ) |
Returns the largest value from the numbers provided | float | > 1 | float |
MIN(num1 [, num2, ...] ) |
Returns the smallest value from the numbers provided | float | > 1 | float |
PRODUCT(num1 [, num2, ...] ) |
Calculates the product of the numbers provided | float | > 1 | float |
STDEV(num1 [, num2, ...] ) |
Returns the standard deviation of a population based on a ample of numbers | float | > 1 | float |
STDEVP(num1 [, num2, ...] ) |
Returns the standard deviation of a population based on an entire population | float | > 1 | float |
SUM(num1 [, num2, ...] ) |
Calculates the sum of the numbers provided | float | > 1 | float |
SUMSQ(num1 [, num2, ...] ) |
Returns the sum of the squares of a series of numbers | float | > 1 | float |
VAR(num1 [, num2, ...] ) |
Returns the variance of a population based on a ample of numbers | float | >1 | float |
VARP(num1 [, num2, ...] ) |
Returns the variance of a population based on an entire population | float | > 1 | float |
Date/time functions | ||||
DATE(year, month, day) |
Calculates a serial date number from year, month and day | integer | 3 | date/time |
DATEDIF(start_date, end_date, interval) |
Calculates the difference between two date value based on a given interval | start_date, end_date : date/timeinterval is a string:"Y" = number of years, "M" = number of months, "D" = number of days |
3 | integer |
DATEVALUE(date_string) |
Converts a (date) string to a date/time value. | string | 1 | date/time |
DAY(value) |
Extracts the day number (1..31) of a date value. | date/time, number, string | 1 | integer |
HOUR(value) |
Extracts the hour (0..23) of a time value. | date/time, number, string | 1 | integer |
MINUTE(value) |
Extracts the minute (0..59) of a time value. | date/time, number, string | 1 | integer |
MONTH(value) |
Extracts the month number (1..12) of a date value. | date/time, number, string | 1 | integer |
NOW() |
Returns the current system date and time. Will refresh whenever the worksheet recalculates. |
none | 0 | date/time |
SECOND(value) |
Extracts the second (0..59) of a time value. | date/time, number, string | 1 | integer |
TIME(year, month, day) |
Calculates a date/time value from hours, minutes and seconds | integer | 3 | date/time |
TIMEVALUE(time_string) |
Converts a (time) string to a date/time value. | string | 1 | date/time |
TODAY() |
Returns the current system date | none | 0 | date/time |
WEEKDAY(value [, type]) |
Returns a number code for the weekday of a date | value : date/time, number, string type=0 : Sunday=1, Saturday=7 (default)type=1 : Monday=1, Sunday=7type=2 : Monday=9, Sunday=6 |
1 or 2 | integer |
YEAR(value) |
Extracts the year of a date value. | date/time, number, string | 1 | integer |
String functions | ||||
CHAR(ascii_value) |
Returns the character based on its ASCII value | integer | 1 | string |
Logical functions | ||||
AND(condition1 [, condition2, ...]) |
Calculates the logical AND of several boolean values | boolean | any | boolean |
OR(condition1 [, condition2, ...]) |
Calculates the logical OR of several boolean values | boolean | any | boolean |
Info functions | ||||
ISBLANK(value) |
Checks for blank or null values. | any | boolean | boolean |