mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-25 14:56:04 +03:00
Markdown documentation
This commit is contained in:
parent
9f575aff68
commit
b075996eee
@ -0,0 +1,11 @@
|
||||
# Calculation Engine - Formula Function Reference
|
||||
|
||||
## Frequently asked questions
|
||||
|
||||
The up-to-date F.A.Q. page for PHPExcel can be found on [http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=FAQ&referringTitle=Requirements][1].
|
||||
|
||||
### Formulas don’t seem to be calculated in Excel2003 using compatibility pack?
|
||||
|
||||
This is normal behaviour of the compatibility pack, Excel2007 displays this correctly. Use PHPExcel_Writer_Excel5 if you really need calculated values, or force recalculation in Excel2003.
|
||||
|
||||
[1]: http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=FAQ&referringTitle=Requirements
|
@ -0,0 +1,123 @@
|
||||
# Calculation Engine - Formula Function Reference
|
||||
|
||||
## Function Reference
|
||||
|
||||
### Handling Date and Time Values
|
||||
|
||||
#### Excel functions that return a Date and Time value
|
||||
|
||||
Any of the Date and Time functions that return a date value in Excel can return either an Excel timestamp or a PHP timestamp or date object.
|
||||
|
||||
It is possible for scripts to change the data type used for returning date values by calling the PHPExcel_Calculation_Functions::setReturnDateType() method:
|
||||
|
||||
```php
|
||||
PHPExcel_Calculation_Functions::setReturnDateType($returnDateType);
|
||||
```
|
||||
|
||||
where the following constants can be used for $returnDateType
|
||||
|
||||
- PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC
|
||||
- PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT
|
||||
- PHPExcel_Calculation_Functions::RETURNDATE_EXCEL
|
||||
|
||||
The method will return a Boolean True on success, False on failure (e.g. if an invalid value is passed in for the return date type).
|
||||
|
||||
The PHPExcel_Calculation_Functions::getReturnDateType() method can be used to determine the current value of this setting:
|
||||
|
||||
```php
|
||||
$returnDateType = PHPExcel_Calculation_Functions::getReturnDateType();
|
||||
```
|
||||
|
||||
The default is RETURNDATE_PHP_NUMERIC.
|
||||
|
||||
##### PHP Timestamps
|
||||
|
||||
If RETURNDATE_PHP_NUMERIC is set for the Return Date Type, then any date value returned to the calling script by any access to the Date and Time functions in Excel will be an integer value that represents the number of seconds from the PHP/Unix base date. The PHP/Unix base date (0) is 00:00 UST on 1st January 1970. This value can be positive or negative: so a value of -3600 would be 23:00 hrs on 31st December 1969; while a value of +3600 would be 01:00 hrs on 1st January 1970. This gives PHP a date range of between 14th December 1901 and 19th January 2038.
|
||||
|
||||
##### PHP DateTime Objects
|
||||
|
||||
If the Return Date Type is set for RETURNDATE_PHP_NUMERIC, then any date value returned to the calling script by any access to the Date and Time functions in Excel will be a PHP date/time object.
|
||||
|
||||
##### Excel Timestamps
|
||||
|
||||
If RETURNDATE_EXCEL is set for the Return Date Type, then the returned date value by any access to the Date and Time functions in Excel will be a floating point value that represents a number of days from the Excel base date. The Excel base date is determined by which calendar Excel uses: the Windows 1900 or the Mac 1904 calendar. 1st January 1900 is the base date for the Windows 1900 calendar while 1st January 1904 is the base date for the Mac 1904 calendar.
|
||||
|
||||
It is possible for scripts to change the calendar used for calculating Excel date values by calling the PHPExcel_Shared_Date::setExcelCalendar() method:
|
||||
|
||||
```php
|
||||
PHPExcel_Shared_Date::setExcelCalendar($baseDate);
|
||||
```
|
||||
|
||||
where the following constants can be used for $baseDate
|
||||
|
||||
- PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900
|
||||
- PHPExcel_Shared_Date::CALENDAR_MAC_1904
|
||||
|
||||
The method will return a Boolean True on success, False on failure (e.g. if an invalid value is passed in).
|
||||
|
||||
The PHPExcel_Shared_Date::getExcelCalendar() method can be used to determine the current value of this setting:
|
||||
|
||||
```php
|
||||
$baseDate = PHPExcel_Shared_Date::getExcelCalendar();
|
||||
```
|
||||
The default is CALENDAR_WINDOWS_1900.
|
||||
|
||||
##### Functions that return a Date/Time Value
|
||||
|
||||
- DATE
|
||||
- DATEVALUE
|
||||
- EDATE
|
||||
- EOMONTH
|
||||
- NOW
|
||||
- TIME
|
||||
- TIMEVALUE
|
||||
- TODAY
|
||||
|
||||
#### Excel functions that accept Date and Time values as parameters
|
||||
|
||||
Date values passed in as parameters to a function can be an Excel timestamp or a PHP timestamp; or date object; or a string containing a date value (e.g. '1-Jan-2009'). PHPExcel will attempt to identify their type based on the PHP datatype:
|
||||
|
||||
An integer numeric value will be treated as a PHP/Unix timestamp. A real (floating point) numeric value will be treated as an Excel date/timestamp. Any PHP DateTime object will be treated as a DateTime object. Any string value (even one containing straight numeric data) will be converted to a date/time object for validation as a date value based on the server locale settings, so passing through an ambiguous value of '07/08/2008' will be treated as 7th August 2008 if your server settings are UK, but as 8th July 2008 if your server settings are US. However, if you pass through a value such as '31/12/2008' that would be considered an error by a US-based server, but which is not ambiguous, then PHPExcel will attempt to correct this to 31st December 2008. If the content of the string doesn’t match any of the formats recognised by the php date/time object implementation of strtotime() (which can handle a wider range of formats than the normal strtotime() function), then the function will return a '#VALUE' error. However, Excel recommends that you should always use date/timestamps for your date functions, and the recommendation for PHPExcel is the same: avoid strings because the result is not predictable.
|
||||
|
||||
The same principle applies when data is being written to Excel. Cells containing date actual values (rather than Excel functions that return a date value) are always written as Excel dates, converting where necessary. If a cell formatted as a date contains an integer or date/time object value, then it is converted to an Excel value for writing: if a cell formatted as a date contains a real value, then no conversion is required. Note that string values are written as strings rather than converted to Excel date timestamp values.
|
||||
|
||||
##### Functions that expect a Date/Time Value
|
||||
|
||||
- DATEDIF
|
||||
- DAY
|
||||
- DAYS360
|
||||
- EDATE
|
||||
- EOMONTH
|
||||
- HOUR
|
||||
- MINUTE
|
||||
- MONTH
|
||||
- NETWORKDAYS
|
||||
- SECOND
|
||||
- WEEKDAY
|
||||
- WEEKNUM
|
||||
- WORKDAY
|
||||
- YEAR
|
||||
- YEARFRAC
|
||||
|
||||
#### Helper Methods
|
||||
|
||||
In addition to the setExcelCalendar() and getExcelCalendar() methods, a number of other methods are available in the PHPExcel_Shared_Date class that can help when working with dates:
|
||||
|
||||
##### PHPExcel_Shared_Date::ExcelToPHP($excelDate)
|
||||
|
||||
Converts a date/time from an Excel date timestamp to return a PHP serialized date/timestamp.
|
||||
|
||||
Note that this method does not trap for Excel dates that fall outside of the valid range for a PHP date timestamp.
|
||||
|
||||
##### PHPExcel_Shared_Date::ExcelToPHPObject($excelDate)
|
||||
|
||||
Converts a date from an Excel date/timestamp to return a PHP DateTime object.
|
||||
|
||||
##### PHPExcel_Shared_Date::PHPToExcel($PHPDate)
|
||||
|
||||
Converts a PHP serialized date/timestamp or a PHP DateTime object to return an Excel date timestamp.
|
||||
|
||||
##### PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0)
|
||||
|
||||
Takes year, month and day values (and optional hour, minute and second values) and returns an Excel date timestamp value.
|
||||
|
@ -0,0 +1,36 @@
|
||||
# Calculation Engine - Formula Function Reference
|
||||
|
||||
## General Introduction
|
||||
|
||||
### Function that are not Supported in Excel5
|
||||
|
||||
Not all functions are supported by the Excel 5 Writer. Use of these functions within your workbooks will result in an error when trying to write to Excel5.
|
||||
|
||||
The following is the list of those functions that are implemented within PHPExcel, but that cannot currently be written to Excel 5.
|
||||
|
||||
#### Cube Functions
|
||||
|
||||
Excel Function | Notes
|
||||
--------------------|---------
|
||||
CUBEKPIMEMBER | Not yet Implemented
|
||||
CUBEMEMBER | Not yet Implemented
|
||||
CUBEMEMBERPROPERTY | Not yet Implemented
|
||||
CUBERANKEDMEMBER | Not yet Implemented
|
||||
CUBESET | Not yet Implemented
|
||||
CUBESETCOUNT | Not yet Implemented
|
||||
CUBEVALUE | Not yet Implemented
|
||||
|
||||
|
||||
#### Database Functions
|
||||
|
||||
Excel Function | Notes
|
||||
---------------|---------
|
||||
|
||||
|
||||
#### Date and Time Functions
|
||||
|
||||
Excel Function | Notes
|
||||
---------------|---------
|
||||
EDATE | Not a standard function within Excel 5, but an add-in from the Analysis ToolPak.
|
||||
EOMONTH | Not a standard function within Excel 5, but an add-in from the Analysis ToolPak.
|
||||
|
@ -0,0 +1,34 @@
|
||||
# Calculation Engine - Formula Function Reference
|
||||
|
||||
## Function Reference
|
||||
|
||||
### Cube Functions
|
||||
|
||||
#### CUBEKPIMEMBER
|
||||
|
||||
Not yet implemented.
|
||||
|
||||
#### CUBEMEMBER
|
||||
|
||||
Not yet implemented.
|
||||
|
||||
#### CUBEMEMBERPROPERTY
|
||||
|
||||
Not yet implemented.
|
||||
|
||||
#### CUBERANKEDMEMBER
|
||||
|
||||
Not yet implemented.
|
||||
|
||||
#### CUBESET
|
||||
|
||||
Not yet implemented.
|
||||
|
||||
#### CUBESETCOUNT
|
||||
|
||||
Not yet implemented.
|
||||
|
||||
#### CUBEVALUE
|
||||
|
||||
Not yet implemented.
|
||||
|
@ -0,0 +1,618 @@
|
||||
# Calculation Engine - Formula Function Reference
|
||||
|
||||
## Function Reference
|
||||
|
||||
### Database Functions
|
||||
|
||||
#### DAVERAGE
|
||||
|
||||
The DAVERAGE function returns the average value of the cells in a column of a list or database that match conditions you specify.
|
||||
|
||||
##### Syntax
|
||||
|
||||
```
|
||||
DAVERAGE (database, field, criteria)
|
||||
```
|
||||
|
||||
##### Parameters
|
||||
|
||||
**database** The range of cells that makes up the list or database.
|
||||
|
||||
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
|
||||
|
||||
**field** Indicates which column of the database is used in the function.
|
||||
|
||||
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
|
||||
|
||||
**criteria** The range of cells that contains the conditions you specify.
|
||||
|
||||
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
|
||||
|
||||
##### Return Value
|
||||
|
||||
**float** The average value of the matching cells.
|
||||
|
||||
This is the statistical mean.
|
||||
|
||||
##### Examples
|
||||
|
||||
```php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
|
||||
$worksheet->setCellValue('A12', '=DAVERAGE(A4:E10,"Yield",A1:B2)');
|
||||
|
||||
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
|
||||
// $retVal = 12
|
||||
```
|
||||
|
||||
##### Notes
|
||||
|
||||
There are no additional notes on this function
|
||||
|
||||
#### DCOUNT
|
||||
|
||||
The DCOUNT function returns the count of cells that contain a number in a column of a list or database matching conditions that you specify.
|
||||
|
||||
##### Syntax
|
||||
|
||||
```
|
||||
DCOUNT(database, [field], criteria)
|
||||
```
|
||||
|
||||
##### Parameters
|
||||
|
||||
**database** The range of cells that makes up the list or database.
|
||||
|
||||
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
|
||||
|
||||
**field** Indicates which column of the database is used in the function.
|
||||
|
||||
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
|
||||
|
||||
**criteria** The range of cells that contains the conditions you specify.
|
||||
|
||||
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
|
||||
|
||||
##### Return Value
|
||||
|
||||
**float** The count of the matching cells.
|
||||
|
||||
##### Examples
|
||||
|
||||
```php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
|
||||
$worksheet->setCellValue('A12', '=DCOUNT(A4:E10,"Height",A1:B3)');
|
||||
|
||||
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
|
||||
|
||||
// $retVal = 3
|
||||
```
|
||||
|
||||
##### Notes
|
||||
|
||||
In MS Excel, The field argument is optional. If field is omitted, DCOUNT counts all records in the database that match the criteria. This logic has not yet been implemented in PHPExcel.
|
||||
|
||||
#### DCOUNTA
|
||||
|
||||
The DCOUNT function returns the count of cells that aren’t blank in a column of a list or database and that match conditions that you specify.
|
||||
|
||||
##### Syntax
|
||||
|
||||
```
|
||||
DCOUNTA(database, [field], criteria)
|
||||
```
|
||||
|
||||
##### Parameters
|
||||
|
||||
**database** The range of cells that makes up the list or database.
|
||||
|
||||
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
|
||||
|
||||
**field** Indicates which column of the database is used in the function.
|
||||
|
||||
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
|
||||
|
||||
**criteria** The range of cells that contains the conditions you specify.
|
||||
|
||||
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
|
||||
|
||||
##### Return Value
|
||||
|
||||
**float** The count of the matching cells.
|
||||
|
||||
##### Examples
|
||||
|
||||
```php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
|
||||
$worksheet->setCellValue('A12', '=DCOUNTA(A4:E10,"Yield",A1:A3)');
|
||||
|
||||
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
|
||||
|
||||
// $retVal = 5
|
||||
```
|
||||
|
||||
##### Notes
|
||||
|
||||
In MS Excel, The field argument is optional. If field is omitted, DCOUNTA counts all records in the database that match the criteria. This logic has not yet been implemented in PHPExcel.
|
||||
|
||||
#### DGET
|
||||
|
||||
The DGET function extracts a single value from a column of a list or database that matches conditions that you specify.
|
||||
|
||||
##### Syntax
|
||||
|
||||
```
|
||||
DGET(database, field, criteria)
|
||||
```
|
||||
|
||||
##### Parameters
|
||||
|
||||
**database** The range of cells that makes up the list or database.
|
||||
|
||||
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
|
||||
|
||||
**field** Indicates which column of the database is used in the function.
|
||||
|
||||
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
|
||||
|
||||
**criteria** The range of cells that contains the conditions you specify.
|
||||
|
||||
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
|
||||
|
||||
##### Return Value
|
||||
|
||||
**mixed** The value from the selected column of the matching row.
|
||||
|
||||
#### Examples
|
||||
|
||||
```php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
|
||||
$worksheet->setCellValue('A12', '=GET(A4:E10,"Age",A1:F2)');
|
||||
|
||||
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
|
||||
// $retVal = 14
|
||||
```
|
||||
|
||||
##### Notes
|
||||
|
||||
There are no additional notes on this function
|
||||
|
||||
#### DMAX
|
||||
|
||||
The DMAX function returns the largest number in a column of a list or database that matches conditions you specify.
|
||||
|
||||
##### Syntax
|
||||
|
||||
```
|
||||
DMAX(database, field, criteria)
|
||||
```
|
||||
|
||||
##### Parameters
|
||||
|
||||
**database** The range of cells that makes up the list or database.
|
||||
|
||||
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
|
||||
|
||||
**field** Indicates which column of the database is used in the function.
|
||||
|
||||
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
|
||||
|
||||
**criteria** The range of cells that contains the conditions you specify.
|
||||
|
||||
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
|
||||
|
||||
##### Return Value
|
||||
|
||||
**float** The maximum value of the matching cells.
|
||||
|
||||
##### Examples
|
||||
|
||||
```php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
|
||||
$worksheet->setCellValue('A12', '=DMAX(A4:E10,"Profit",A1:B2)');
|
||||
|
||||
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
|
||||
// $retVal = 105
|
||||
```
|
||||
|
||||
##### Notes
|
||||
|
||||
There are no additional notes on this function
|
||||
|
||||
#### DMIN
|
||||
|
||||
The DMIN function returns the smallest number in a column of a list or database that matches conditions you specify.
|
||||
|
||||
##### Syntax
|
||||
|
||||
```
|
||||
DMIN(database, field, criteria)
|
||||
```
|
||||
|
||||
##### Parameters
|
||||
|
||||
**database** The range of cells that makes up the list or database.
|
||||
|
||||
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
|
||||
|
||||
**field** Indicates which column of the database is used in the function.
|
||||
|
||||
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
|
||||
|
||||
**criteria** The range of cells that contains the conditions you specify.
|
||||
|
||||
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
|
||||
|
||||
##### Return Value
|
||||
|
||||
**float** The minimum value of the matching cells.
|
||||
|
||||
##### Examples
|
||||
|
||||
```php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
|
||||
$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Yield",A1:A3)');
|
||||
|
||||
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
|
||||
// $retVal = 6
|
||||
```
|
||||
|
||||
##### Notes
|
||||
|
||||
There are no additional notes on this function
|
||||
|
||||
#### DPRODUCT
|
||||
|
||||
The DPRODUCT function multiplies the values in a column of a list or database that match conditions that you specify.
|
||||
|
||||
##### Syntax
|
||||
|
||||
```
|
||||
DPRODUCT(database, field, criteria)
|
||||
```
|
||||
|
||||
##### Parameters
|
||||
|
||||
**database** The range of cells that makes up the list or database.
|
||||
|
||||
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
|
||||
|
||||
**field** Indicates which column of the database is used in the function.
|
||||
|
||||
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
|
||||
|
||||
**criteria** The range of cells that contains the conditions you specify.
|
||||
|
||||
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
|
||||
|
||||
##### Return Value
|
||||
|
||||
**float** The product of the matching cells.
|
||||
|
||||
##### Examples
|
||||
|
||||
```php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
|
||||
$worksheet->setCellValue('A12', '=DPRODUCT(A4:E10,"Yield",A1:B2)');
|
||||
|
||||
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
|
||||
// $retVal = 140
|
||||
```
|
||||
|
||||
##### Notes
|
||||
|
||||
There are no additional notes on this function
|
||||
|
||||
#### DSTDEV
|
||||
|
||||
The DSTDEV function 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.
|
||||
|
||||
##### Syntax
|
||||
|
||||
```
|
||||
DSTDEV(database, field, criteria)
|
||||
```
|
||||
|
||||
##### Parameters
|
||||
|
||||
**database** The range of cells that makes up the list or database.
|
||||
|
||||
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
|
||||
|
||||
**field** Indicates which column of the database is used in the function.
|
||||
|
||||
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
|
||||
|
||||
**criteria** The range of cells that contains the conditions you specify.
|
||||
|
||||
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
|
||||
|
||||
##### Return Value
|
||||
|
||||
**float** The estimated standard deviation of the matching cells.
|
||||
|
||||
##### Examples
|
||||
|
||||
```php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
|
||||
$worksheet->setCellValue('A12', '=DSTDEV(A4:E10,"Yield",A1:A3)');
|
||||
|
||||
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
|
||||
// $retVal = 2.97
|
||||
```
|
||||
|
||||
##### Notes
|
||||
|
||||
There are no additional notes on this function
|
||||
|
||||
#### DSTDEVP
|
||||
|
||||
The DSTDEVP function 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.
|
||||
|
||||
##### Syntax
|
||||
|
||||
```
|
||||
DSTDEVP(database, field, criteria)
|
||||
```
|
||||
|
||||
##### Parameters
|
||||
|
||||
**database** The range of cells that makes up the list or database.
|
||||
|
||||
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
|
||||
|
||||
**field** Indicates which column of the database is used in the function.
|
||||
|
||||
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
|
||||
|
||||
**criteria** The range of cells that contains the conditions you specify.
|
||||
|
||||
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
|
||||
|
||||
##### Return Value
|
||||
|
||||
**float** The estimated standard deviation of the matching cells.
|
||||
|
||||
##### Examples
|
||||
|
||||
```php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
|
||||
$worksheet->setCellValue('A12', '=DSTDEVP(A4:E10,"Yield",A1:A3)');
|
||||
|
||||
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
|
||||
// $retVal = 2.65
|
||||
```
|
||||
|
||||
##### Notes
|
||||
|
||||
There are no additional notes on this function
|
||||
|
||||
#### DSUM
|
||||
|
||||
The DSUM function adds the numbers in a column of a list or database that matches conditions you specify.
|
||||
|
||||
##### Syntax
|
||||
|
||||
```
|
||||
DSUM(database, field, criteria)
|
||||
```
|
||||
|
||||
##### Parameters
|
||||
|
||||
**database** The range of cells that makes up the list or database.
|
||||
|
||||
A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
|
||||
|
||||
**field** Indicates which column of the database is used in the function.
|
||||
|
||||
Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
|
||||
|
||||
**criteria** The range of cells that contains the conditions you specify.
|
||||
|
||||
You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
|
||||
|
||||
##### Return Value
|
||||
|
||||
**float** The total value of the matching cells.
|
||||
|
||||
##### Examples
|
||||
|
||||
```php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
|
||||
$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Profit",A1:A2)');
|
||||
|
||||
$retVal = $worksheet->getCell('A12')->getCalculatedValue();
|
||||
// $retVal = 225
|
||||
```
|
||||
|
||||
##### Notes
|
||||
|
||||
There are no additional notes on this function
|
||||
|
||||
#### DVAR
|
||||
|
||||
Not yet documented.
|
||||
|
||||
#### DVARP
|
||||
|
||||
Not yet documented.
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user