Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
4487 lines (4248 sloc) 181 KB
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\CyclicReferenceStack;
use PhpOffice\PhpSpreadsheet\Calculation\Engine\Logger;
use PhpOffice\PhpSpreadsheet\Calculation\Token\Stack;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\NamedRange;
use PhpOffice\PhpSpreadsheet\Shared;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class Calculation
{
/** Constants */
/** Regular Expressions */
// Numeric operand
const CALCULATION_REGEXP_NUMBER = '[-+]?\d*\.?\d+(e[-+]?\d+)?';
// String operand
const CALCULATION_REGEXP_STRING = '"(?:[^"]|"")*"';
// Opening bracket
const CALCULATION_REGEXP_OPENBRACE = '\(';
// Function (allow for the old @ symbol that could be used to prefix a function, but we'll ignore it)
const CALCULATION_REGEXP_FUNCTION = '@?(?:_xlfn\.)?([A-Z][A-Z0-9\.]*)[\s]*\(';
// Cell reference (cell or range of cells, with or without a sheet reference)
const CALCULATION_REGEXP_CELLREF = '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d{1,7})';
// Named Range of cells
const CALCULATION_REGEXP_NAMEDRANGE = '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?([_A-Z][_A-Z0-9\.]*)';
// Error
const CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?';
/** constants */
const RETURN_ARRAY_AS_ERROR = 'error';
const RETURN_ARRAY_AS_VALUE = 'value';
const RETURN_ARRAY_AS_ARRAY = 'array';
private static $returnArrayAsType = self::RETURN_ARRAY_AS_VALUE;
/**
* Instance of this class.
*
* @var Calculation
*/
private static $instance;
/**
* Instance of the spreadsheet this Calculation Engine is using.
*
* @var Spreadsheet
*/
private $spreadsheet;
/**
* Calculation cache.
*
* @var array
*/
private $calculationCache = [];
/**
* Calculation cache enabled.
*
* @var bool
*/
private $calculationCacheEnabled = true;
/**
* List of operators that can be used within formulae
* The true/false value indicates whether it is a binary operator or a unary operator.
*
* @var array
*/
private static $operators = [
'+' => true, '-' => true, '*' => true, '/' => true,
'^' => true, '&' => true, '%' => false, '~' => false,
'>' => true, '<' => true, '=' => true, '>=' => true,
'<=' => true, '<>' => true, '|' => true, ':' => true,
];
/**
* List of binary operators (those that expect two operands).
*
* @var array
*/
private static $binaryOperators = [
'+' => true, '-' => true, '*' => true, '/' => true,
'^' => true, '&' => true, '>' => true, '<' => true,
'=' => true, '>=' => true, '<=' => true, '<>' => true,
'|' => true, ':' => true,
];
/**
* The debug log generated by the calculation engine.
*
* @var Logger
*/
private $debugLog;
/**
* Flag to determine how formula errors should be handled
* If true, then a user error will be triggered
* If false, then an exception will be thrown.
*
* @var bool
*/
public $suppressFormulaErrors = false;
/**
* Error message for any error that was raised/thrown by the calculation engine.
*
* @var string
*/
public $formulaError;
/**
* An array of the nested cell references accessed by the calculation engine, used for the debug log.
*
* @var CyclicReferenceStack
*/
private $cyclicReferenceStack;
private $cellStack = [];
/**
* Current iteration counter for cyclic formulae
* If the value is 0 (or less) then cyclic formulae will throw an exception,
* otherwise they will iterate to the limit defined here before returning a result.
*
* @var int
*/
private $cyclicFormulaCounter = 1;
private $cyclicFormulaCell = '';
/**
* Number of iterations for cyclic formulae.
*
* @var int
*/
public $cyclicFormulaCount = 1;
/**
* Epsilon Precision used for comparisons in calculations.
*
* @var float
*/
private $delta = 0.1e-12;
/**
* The current locale setting.
*
* @var string
*/
private static $localeLanguage = 'en_us'; // US English (default locale)
/**
* List of available locale settings
* Note that this is read for the locale subdirectory only when requested.
*
* @var string[]
*/
private static $validLocaleLanguages = [
'en', // English (default language)
];
/**
* Locale-specific argument separator for function arguments.
*
* @var string
*/
private static $localeArgumentSeparator = ',';
private static $localeFunctions = [];
/**
* Locale-specific translations for Excel constants (True, False and Null).
*
* @var string[]
*/
public static $localeBoolean = [
'TRUE' => 'TRUE',
'FALSE' => 'FALSE',
'NULL' => 'NULL',
];
/**
* Excel constant string translations to their PHP equivalents
* Constant conversion from text name/value to actual (datatyped) value.
*
* @var string[]
*/
private static $excelConstants = [
'TRUE' => true,
'FALSE' => false,
'NULL' => null,
];
// PhpSpreadsheet functions
private static $phpSpreadsheetFunctions = [
'ABS' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'abs',
'argumentCount' => '1',
],
'ACCRINT' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'ACCRINT'],
'argumentCount' => '4-7',
],
'ACCRINTM' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'ACCRINTM'],
'argumentCount' => '3-5',
],
'ACOS' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'acos',
'argumentCount' => '1',
],
'ACOSH' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'acosh',
'argumentCount' => '1',
],
'ACOT' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'ACOT'],
'argumentCount' => '1',
],
'ACOTH' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'ACOTH'],
'argumentCount' => '1',
],
'ADDRESS' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'cellAddress'],
'argumentCount' => '2-5',
],
'AMORDEGRC' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'AMORDEGRC'],
'argumentCount' => '6,7',
],
'AMORLINC' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'AMORLINC'],
'argumentCount' => '6,7',
],
'AND' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Logical::class, 'logicalAnd'],
'argumentCount' => '1+',
],
'AREAS' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '1',
],
'ASC' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '1',
],
'ASIN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'asin',
'argumentCount' => '1',
],
'ASINH' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'asinh',
'argumentCount' => '1',
],
'ATAN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'atan',
'argumentCount' => '1',
],
'ATAN2' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'ATAN2'],
'argumentCount' => '2',
],
'ATANH' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'atanh',
'argumentCount' => '1',
],
'AVEDEV' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'AVEDEV'],
'argumentCount' => '1+',
],
'AVERAGE' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'AVERAGE'],
'argumentCount' => '1+',
],
'AVERAGEA' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'AVERAGEA'],
'argumentCount' => '1+',
],
'AVERAGEIF' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'AVERAGEIF'],
'argumentCount' => '2,3',
],
'AVERAGEIFS' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '3+',
],
'BAHTTEXT' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '1',
],
'BESSELI' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BESSELI'],
'argumentCount' => '2',
],
'BESSELJ' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BESSELJ'],
'argumentCount' => '2',
],
'BESSELK' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BESSELK'],
'argumentCount' => '2',
],
'BESSELY' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BESSELY'],
'argumentCount' => '2',
],
'BETADIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'BETADIST'],
'argumentCount' => '3-5',
],
'BETAINV' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'BETAINV'],
'argumentCount' => '3-5',
],
'BIN2DEC' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BINTODEC'],
'argumentCount' => '1',
],
'BIN2HEX' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BINTOHEX'],
'argumentCount' => '1,2',
],
'BIN2OCT' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BINTOOCT'],
'argumentCount' => '1,2',
],
'BINOMDIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'BINOMDIST'],
'argumentCount' => '4',
],
'BITAND' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BITAND'],
'argumentCount' => '2',
],
'BITOR' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BITOR'],
'argumentCount' => '2',
],
'BITXOR' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BITOR'],
'argumentCount' => '2',
],
'BITLSHIFT' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BITLSHIFT'],
'argumentCount' => '2',
],
'BITRSHIFT' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BITRSHIFT'],
'argumentCount' => '2',
],
'CEILING' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'CEILING'],
'argumentCount' => '2',
],
'CELL' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '1,2',
],
'CHAR' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'CHARACTER'],
'argumentCount' => '1',
],
'CHIDIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'CHIDIST'],
'argumentCount' => '2',
],
'CHIINV' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'CHIINV'],
'argumentCount' => '2',
],
'CHITEST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2',
],
'CHOOSE' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'CHOOSE'],
'argumentCount' => '2+',
],
'CLEAN' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'TRIMNONPRINTABLE'],
'argumentCount' => '1',
],
'CODE' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'ASCIICODE'],
'argumentCount' => '1',
],
'COLUMN' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'COLUMN'],
'argumentCount' => '-1',
'passByReference' => [true],
],
'COLUMNS' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'COLUMNS'],
'argumentCount' => '1',
],
'COMBIN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'COMBIN'],
'argumentCount' => '2',
],
'COMPLEX' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'COMPLEX'],
'argumentCount' => '2,3',
],
'CONCAT' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'CONCATENATE'],
'argumentCount' => '1+',
],
'CONCATENATE' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'CONCATENATE'],
'argumentCount' => '1+',
],
'CONFIDENCE' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'CONFIDENCE'],
'argumentCount' => '3',
],
'CONVERT' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'CONVERTUOM'],
'argumentCount' => '3',
],
'CORREL' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'CORREL'],
'argumentCount' => '2',
],
'COS' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'cos',
'argumentCount' => '1',
],
'COSH' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'cosh',
'argumentCount' => '1',
],
'COT' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'COT'],
'argumentCount' => '1',
],
'COTH' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'COTH'],
'argumentCount' => '1',
],
'COUNT' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'COUNT'],
'argumentCount' => '1+',
],
'COUNTA' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'COUNTA'],
'argumentCount' => '1+',
],
'COUNTBLANK' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'COUNTBLANK'],
'argumentCount' => '1',
],
'COUNTIF' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'COUNTIF'],
'argumentCount' => '2',
],
'COUNTIFS' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'COUNTIFS'],
'argumentCount' => '2+',
],
'COUPDAYBS' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'COUPDAYBS'],
'argumentCount' => '3,4',
],
'COUPDAYS' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'COUPDAYS'],
'argumentCount' => '3,4',
],
'COUPDAYSNC' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'COUPDAYSNC'],
'argumentCount' => '3,4',
],
'COUPNCD' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'COUPNCD'],
'argumentCount' => '3,4',
],
'COUPNUM' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'COUPNUM'],
'argumentCount' => '3,4',
],
'COUPPCD' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'COUPPCD'],
'argumentCount' => '3,4',
],
'COVAR' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'COVAR'],
'argumentCount' => '2',
],
'CRITBINOM' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'CRITBINOM'],
'argumentCount' => '3',
],
'CSC' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'CSC'],
'argumentCount' => '1',
],
'CSCH' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'CSCH'],
'argumentCount' => '1',
],
'CUBEKPIMEMBER' => [
'category' => Category::CATEGORY_CUBE,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '?',
],
'CUBEMEMBER' => [
'category' => Category::CATEGORY_CUBE,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '?',
],
'CUBEMEMBERPROPERTY' => [
'category' => Category::CATEGORY_CUBE,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '?',
],
'CUBERANKEDMEMBER' => [
'category' => Category::CATEGORY_CUBE,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '?',
],
'CUBESET' => [
'category' => Category::CATEGORY_CUBE,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '?',
],
'CUBESETCOUNT' => [
'category' => Category::CATEGORY_CUBE,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '?',
],
'CUBEVALUE' => [
'category' => Category::CATEGORY_CUBE,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '?',
],
'CUMIPMT' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'CUMIPMT'],
'argumentCount' => '6',
],
'CUMPRINC' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'CUMPRINC'],
'argumentCount' => '6',
],
'DATE' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'DATE'],
'argumentCount' => '3',
],
'DATEDIF' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'DATEDIF'],
'argumentCount' => '2,3',
],
'DATEVALUE' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'DATEVALUE'],
'argumentCount' => '1',
],
'DAVERAGE' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DAVERAGE'],
'argumentCount' => '3',
],
'DAY' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'DAYOFMONTH'],
'argumentCount' => '1',
],
'DAYS' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'DAYS'],
'argumentCount' => '2',
],
'DAYS360' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'DAYS360'],
'argumentCount' => '2,3',
],
'DB' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'DB'],
'argumentCount' => '4,5',
],
'DCOUNT' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DCOUNT'],
'argumentCount' => '3',
],
'DCOUNTA' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DCOUNTA'],
'argumentCount' => '3',
],
'DDB' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'DDB'],
'argumentCount' => '4,5',
],
'DEC2BIN' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'DECTOBIN'],
'argumentCount' => '1,2',
],
'DEC2HEX' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'DECTOHEX'],
'argumentCount' => '1,2',
],
'DEC2OCT' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'DECTOOCT'],
'argumentCount' => '1,2',
],
'DEGREES' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'rad2deg',
'argumentCount' => '1',
],
'DELTA' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'DELTA'],
'argumentCount' => '1,2',
],
'DEVSQ' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'DEVSQ'],
'argumentCount' => '1+',
],
'DGET' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DGET'],
'argumentCount' => '3',
],
'DISC' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'DISC'],
'argumentCount' => '4,5',
],
'DMAX' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DMAX'],
'argumentCount' => '3',
],
'DMIN' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DMIN'],
'argumentCount' => '3',
],
'DOLLAR' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'DOLLAR'],
'argumentCount' => '1,2',
],
'DOLLARDE' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'DOLLARDE'],
'argumentCount' => '2',
],
'DOLLARFR' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'DOLLARFR'],
'argumentCount' => '2',
],
'DPRODUCT' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DPRODUCT'],
'argumentCount' => '3',
],
'DSTDEV' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DSTDEV'],
'argumentCount' => '3',
],
'DSTDEVP' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DSTDEVP'],
'argumentCount' => '3',
],
'DSUM' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DSUM'],
'argumentCount' => '3',
],
'DURATION' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '5,6',
],
'DVAR' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DVAR'],
'argumentCount' => '3',
],
'DVARP' => [
'category' => Category::CATEGORY_DATABASE,
'functionCall' => [Database::class, 'DVARP'],
'argumentCount' => '3',
],
'EDATE' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'EDATE'],
'argumentCount' => '2',
],
'EFFECT' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'EFFECT'],
'argumentCount' => '2',
],
'EOMONTH' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'EOMONTH'],
'argumentCount' => '2',
],
'ERF' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'ERF'],
'argumentCount' => '1,2',
],
'ERF.PRECISE' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'ERFPRECISE'],
'argumentCount' => '1',
],
'ERFC' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'ERFC'],
'argumentCount' => '1',
],
'ERFC.PRECISE' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'ERFC'],
'argumentCount' => '1',
],
'ERROR.TYPE' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'errorType'],
'argumentCount' => '1',
],
'EVEN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'EVEN'],
'argumentCount' => '1',
],
'EXACT' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'EXACT'],
'argumentCount' => '2',
],
'EXP' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'exp',
'argumentCount' => '1',
],
'EXPONDIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'EXPONDIST'],
'argumentCount' => '3',
],
'FACT' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'FACT'],
'argumentCount' => '1',
],
'FACTDOUBLE' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'FACTDOUBLE'],
'argumentCount' => '1',
],
'FALSE' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Logical::class, 'FALSE'],
'argumentCount' => '0',
],
'FDIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '3',
],
'FIND' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'SEARCHSENSITIVE'],
'argumentCount' => '2,3',
],
'FINDB' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'SEARCHSENSITIVE'],
'argumentCount' => '2,3',
],
'FINV' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '3',
],
'FISHER' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'FISHER'],
'argumentCount' => '1',
],
'FISHERINV' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'FISHERINV'],
'argumentCount' => '1',
],
'FIXED' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'FIXEDFORMAT'],
'argumentCount' => '1-3',
],
'FLOOR' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'FLOOR'],
'argumentCount' => '2',
],
'FORECAST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'FORECAST'],
'argumentCount' => '3',
],
'FORMULATEXT' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'FORMULATEXT'],
'argumentCount' => '1',
'passCellReference' => true,
'passByReference' => [true],
],
'FREQUENCY' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2',
],
'FTEST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2',
],
'FV' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'FV'],
'argumentCount' => '3-5',
],
'FVSCHEDULE' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'FVSCHEDULE'],
'argumentCount' => '2',
],
'GAMMADIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'GAMMADIST'],
'argumentCount' => '4',
],
'GAMMAINV' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'GAMMAINV'],
'argumentCount' => '3',
],
'GAMMALN' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'GAMMALN'],
'argumentCount' => '1',
],
'GCD' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'GCD'],
'argumentCount' => '1+',
],
'GEOMEAN' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'GEOMEAN'],
'argumentCount' => '1+',
],
'GESTEP' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'GESTEP'],
'argumentCount' => '1,2',
],
'GETPIVOTDATA' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2+',
],
'GROWTH' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'GROWTH'],
'argumentCount' => '1-4',
],
'HARMEAN' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'HARMEAN'],
'argumentCount' => '1+',
],
'HEX2BIN' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'HEXTOBIN'],
'argumentCount' => '1,2',
],
'HEX2DEC' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'HEXTODEC'],
'argumentCount' => '1',
],
'HEX2OCT' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'HEXTOOCT'],
'argumentCount' => '1,2',
],
'HLOOKUP' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'HLOOKUP'],
'argumentCount' => '3,4',
],
'HOUR' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'HOUROFDAY'],
'argumentCount' => '1',
],
'HYPERLINK' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'HYPERLINK'],
'argumentCount' => '1,2',
'passCellReference' => true,
],
'HYPGEOMDIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'HYPGEOMDIST'],
'argumentCount' => '4',
],
'IF' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Logical::class, 'statementIf'],
'argumentCount' => '1-3',
],
'IFERROR' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Logical::class, 'IFERROR'],
'argumentCount' => '2',
],
'IMABS' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMABS'],
'argumentCount' => '1',
],
'IMAGINARY' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMAGINARY'],
'argumentCount' => '1',
],
'IMARGUMENT' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMARGUMENT'],
'argumentCount' => '1',
],
'IMCONJUGATE' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMCONJUGATE'],
'argumentCount' => '1',
],
'IMCOS' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMCOS'],
'argumentCount' => '1',
],
'IMCOSH' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMCOSH'],
'argumentCount' => '1',
],
'IMCOT' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMCOT'],
'argumentCount' => '1',
],
'IMCSC' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMCSC'],
'argumentCount' => '1',
],
'IMCSCH' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMCSCH'],
'argumentCount' => '1',
],
'IMDIV' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMDIV'],
'argumentCount' => '2',
],
'IMEXP' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMEXP'],
'argumentCount' => '1',
],
'IMLN' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMLN'],
'argumentCount' => '1',
],
'IMLOG10' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMLOG10'],
'argumentCount' => '1',
],
'IMLOG2' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMLOG2'],
'argumentCount' => '1',
],
'IMPOWER' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMPOWER'],
'argumentCount' => '2',
],
'IMPRODUCT' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMPRODUCT'],
'argumentCount' => '1+',
],
'IMREAL' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMREAL'],
'argumentCount' => '1',
],
'IMSEC' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMSEC'],
'argumentCount' => '1',
],
'IMSECH' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMSECH'],
'argumentCount' => '1',
],
'IMSIN' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMSIN'],
'argumentCount' => '1',
],
'IMSINH' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMSINH'],
'argumentCount' => '1',
],
'IMSQRT' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMSQRT'],
'argumentCount' => '1',
],
'IMSUB' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMSUB'],
'argumentCount' => '2',
],
'IMSUM' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMSUM'],
'argumentCount' => '1+',
],
'IMTAN' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMTAN'],
'argumentCount' => '1',
],
'INDEX' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'INDEX'],
'argumentCount' => '1-4',
],
'INDIRECT' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'INDIRECT'],
'argumentCount' => '1,2',
'passCellReference' => true,
],
'INFO' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '1',
],
'INT' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'INT'],
'argumentCount' => '1',
],
'INTERCEPT' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'INTERCEPT'],
'argumentCount' => '2',
],
'INTRATE' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'INTRATE'],
'argumentCount' => '4,5',
],
'IPMT' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'IPMT'],
'argumentCount' => '4-6',
],
'IRR' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'IRR'],
'argumentCount' => '1,2',
],
'ISBLANK' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isBlank'],
'argumentCount' => '1',
],
'ISERR' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isErr'],
'argumentCount' => '1',
],
'ISERROR' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isError'],
'argumentCount' => '1',
],
'ISEVEN' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isEven'],
'argumentCount' => '1',
],
'ISFORMULA' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isFormula'],
'argumentCount' => '1',
'passCellReference' => true,
'passByReference' => [true],
],
'ISLOGICAL' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isLogical'],
'argumentCount' => '1',
],
'ISNA' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isNa'],
'argumentCount' => '1',
],
'ISNONTEXT' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isNonText'],
'argumentCount' => '1',
],
'ISNUMBER' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isNumber'],
'argumentCount' => '1',
],
'ISODD' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isOdd'],
'argumentCount' => '1',
],
'ISOWEEKNUM' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'ISOWEEKNUM'],
'argumentCount' => '1',
],
'ISPMT' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'ISPMT'],
'argumentCount' => '4',
],
'ISREF' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '1',
],
'ISTEXT' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isText'],
'argumentCount' => '1',
],
'JIS' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '1',
],
'KURT' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'KURT'],
'argumentCount' => '1+',
],
'LARGE' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'LARGE'],
'argumentCount' => '2',
],
'LCM' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'LCM'],
'argumentCount' => '1+',
],
'LEFT' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'LEFT'],
'argumentCount' => '1,2',
],
'LEFTB' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'LEFT'],
'argumentCount' => '1,2',
],
'LEN' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'STRINGLENGTH'],
'argumentCount' => '1',
],
'LENB' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'STRINGLENGTH'],
'argumentCount' => '1',
],
'LINEST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'LINEST'],
'argumentCount' => '1-4',
],
'LN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'log',
'argumentCount' => '1',
],
'LOG' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'logBase'],
'argumentCount' => '1,2',
],
'LOG10' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'log10',
'argumentCount' => '1',
],
'LOGEST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'LOGEST'],
'argumentCount' => '1-4',
],
'LOGINV' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'LOGINV'],
'argumentCount' => '3',
],
'LOGNORMDIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'LOGNORMDIST'],
'argumentCount' => '3',
],
'LOOKUP' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'LOOKUP'],
'argumentCount' => '2,3',
],
'LOWER' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'LOWERCASE'],
'argumentCount' => '1',
],
'MATCH' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'MATCH'],
'argumentCount' => '2,3',
],
'MAX' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'MAX'],
'argumentCount' => '1+',
],
'MAXA' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'MAXA'],
'argumentCount' => '1+',
],
'MAXIFS' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'MAXIFS'],
'argumentCount' => '3+',
],
'MDETERM' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'MDETERM'],
'argumentCount' => '1',
],
'MDURATION' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '5,6',
],
'MEDIAN' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'MEDIAN'],
'argumentCount' => '1+',
],
'MEDIANIF' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2+',
],
'MID' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'MID'],
'argumentCount' => '3',
],
'MIDB' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'MID'],
'argumentCount' => '3',
],
'MIN' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'MIN'],
'argumentCount' => '1+',
],
'MINA' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'MINA'],
'argumentCount' => '1+',
],
'MINIFS' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'MINIFS'],
'argumentCount' => '3+',
],
'MINUTE' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'MINUTE'],
'argumentCount' => '1',
],
'MINVERSE' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'MINVERSE'],
'argumentCount' => '1',
],
'MIRR' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'MIRR'],
'argumentCount' => '3',
],
'MMULT' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'MMULT'],
'argumentCount' => '2',
],
'MOD' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'MOD'],
'argumentCount' => '2',
],
'MODE' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'MODE'],
'argumentCount' => '1+',
],
'MODE.SNGL' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'MODE'],
'argumentCount' => '1+',
],
'MONTH' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'MONTHOFYEAR'],
'argumentCount' => '1',
],
'MROUND' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'MROUND'],
'argumentCount' => '2',
],
'MULTINOMIAL' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'MULTINOMIAL'],
'argumentCount' => '1+',
],
'N' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'n'],
'argumentCount' => '1',
],
'NA' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'NA'],
'argumentCount' => '0',
],
'NEGBINOMDIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'NEGBINOMDIST'],
'argumentCount' => '3',
],
'NETWORKDAYS' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'NETWORKDAYS'],
'argumentCount' => '2+',
],
'NOMINAL' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'NOMINAL'],
'argumentCount' => '2',
],
'NORMDIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'NORMDIST'],
'argumentCount' => '4',
],
'NORMINV' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'NORMINV'],
'argumentCount' => '3',
],
'NORMSDIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'NORMSDIST'],
'argumentCount' => '1',
],
'NORMSINV' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'NORMSINV'],
'argumentCount' => '1',
],
'NOT' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Logical::class, 'NOT'],
'argumentCount' => '1',
],
'NOW' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'DATETIMENOW'],
'argumentCount' => '0',
],
'NPER' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'NPER'],
'argumentCount' => '3-5',
],
'NPV' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'NPV'],
'argumentCount' => '2+',
],
'NUMBERVALUE' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'NUMBERVALUE'],
'argumentCount' => '1+',
],
'OCT2BIN' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'OCTTOBIN'],
'argumentCount' => '1,2',
],
'OCT2DEC' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'OCTTODEC'],
'argumentCount' => '1',
],
'OCT2HEX' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'OCTTOHEX'],
'argumentCount' => '1,2',
],
'ODD' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'ODD'],
'argumentCount' => '1',
],
'ODDFPRICE' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '8,9',
],
'ODDFYIELD' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '8,9',
],
'ODDLPRICE' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '7,8',
],
'ODDLYIELD' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '7,8',
],
'OFFSET' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'OFFSET'],
'argumentCount' => '3-5',
'passCellReference' => true,
'passByReference' => [true],
],
'OR' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Logical::class, 'logicalOr'],
'argumentCount' => '1+',
],
'PDURATION' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'PDURATION'],
'argumentCount' => '3',
],
'PEARSON' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'CORREL'],
'argumentCount' => '2',
],
'PERCENTILE' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'PERCENTILE'],
'argumentCount' => '2',
],
'PERCENTRANK' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'PERCENTRANK'],
'argumentCount' => '2,3',
],
'PERMUT' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'PERMUT'],
'argumentCount' => '2',
],
'PHONETIC' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '1',
],
'PI' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'pi',
'argumentCount' => '0',
],
'PMT' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'PMT'],
'argumentCount' => '3-5',
],
'POISSON' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'POISSON'],
'argumentCount' => '3',
],
'POWER' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'POWER'],
'argumentCount' => '2',
],
'PPMT' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'PPMT'],
'argumentCount' => '4-6',
],
'PRICE' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'PRICE'],
'argumentCount' => '6,7',
],
'PRICEDISC' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'PRICEDISC'],
'argumentCount' => '4,5',
],
'PRICEMAT' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'PRICEMAT'],
'argumentCount' => '5,6',
],
'PROB' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '3,4',
],
'PRODUCT' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'PRODUCT'],
'argumentCount' => '1+',
],
'PROPER' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'PROPERCASE'],
'argumentCount' => '1',
],
'PV' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'PV'],
'argumentCount' => '3-5',
],
'QUARTILE' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'QUARTILE'],
'argumentCount' => '2',
],
'QUOTIENT' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'QUOTIENT'],
'argumentCount' => '2',
],
'RADIANS' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'deg2rad',
'argumentCount' => '1',
],
'RAND' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'RAND'],
'argumentCount' => '0',
],
'RANDBETWEEN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'RAND'],
'argumentCount' => '2',
],
'RANK' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'RANK'],
'argumentCount' => '2,3',
],
'RATE' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'RATE'],
'argumentCount' => '3-6',
],
'RECEIVED' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'RECEIVED'],
'argumentCount' => '4-5',
],
'REPLACE' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'REPLACE'],
'argumentCount' => '4',
],
'REPLACEB' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'REPLACE'],
'argumentCount' => '4',
],
'REPT' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => 'str_repeat',
'argumentCount' => '2',
],
'RIGHT' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'RIGHT'],
'argumentCount' => '1,2',
],
'RIGHTB' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'RIGHT'],
'argumentCount' => '1,2',
],
'ROMAN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'ROMAN'],
'argumentCount' => '1,2',
],
'ROUND' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'round',
'argumentCount' => '2',
],
'ROUNDDOWN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'ROUNDDOWN'],
'argumentCount' => '2',
],
'ROUNDUP' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'ROUNDUP'],
'argumentCount' => '2',
],
'ROW' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'ROW'],
'argumentCount' => '-1',
'passByReference' => [true],
],
'ROWS' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'ROWS'],
'argumentCount' => '1',
],
'RRI' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'RRI'],
'argumentCount' => '3',
],
'RSQ' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'RSQ'],
'argumentCount' => '2',
],
'RTD' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '1+',
],
'SEARCH' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'SEARCHINSENSITIVE'],
'argumentCount' => '2,3',
],
'SEARCHB' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'SEARCHINSENSITIVE'],
'argumentCount' => '2,3',
],
'SEC' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SEC'],
'argumentCount' => '1',
],
'SECH' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SECH'],
'argumentCount' => '1',
],
'SECOND' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'SECOND'],
'argumentCount' => '1',
],
'SERIESSUM' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SERIESSUM'],
'argumentCount' => '4',
],
'SIGN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SIGN'],
'argumentCount' => '1',
],
'SIN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'sin',
'argumentCount' => '1',
],
'SINH' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'sinh',
'argumentCount' => '1',
],
'SKEW' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'SKEW'],
'argumentCount' => '1+',
],
'SLN' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'SLN'],
'argumentCount' => '3',
],
'SLOPE' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'SLOPE'],
'argumentCount' => '2',
],
'SMALL' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'SMALL'],
'argumentCount' => '2',
],
'SQRT' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'sqrt',
'argumentCount' => '1',
],
'SQRTPI' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SQRTPI'],
'argumentCount' => '1',
],
'STANDARDIZE' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'STANDARDIZE'],
'argumentCount' => '3',
],
'STDEV' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'STDEV'],
'argumentCount' => '1+',
],
'STDEV.S' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'STDEV'],
'argumentCount' => '1+',
],
'STDEV.P' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'STDEVP'],
'argumentCount' => '1+',
],
'STDEVA' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'STDEVA'],
'argumentCount' => '1+',
],
'STDEVP' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'STDEVP'],
'argumentCount' => '1+',
],
'STDEVPA' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'STDEVPA'],
'argumentCount' => '1+',
],
'STEYX' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'STEYX'],
'argumentCount' => '2',
],
'SUBSTITUTE' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'SUBSTITUTE'],
'argumentCount' => '3,4',
],
'SUBTOTAL' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUBTOTAL'],
'argumentCount' => '2+',
'passCellReference' => true,
],
'SUM' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUM'],
'argumentCount' => '1+',
],
'SUMIF' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUMIF'],
'argumentCount' => '2,3',
],
'SUMIFS' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUMIFS'],
'argumentCount' => '3+',
],
'SUMPRODUCT' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUMPRODUCT'],
'argumentCount' => '1+',
],
'SUMSQ' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUMSQ'],
'argumentCount' => '1+',
],
'SUMX2MY2' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUMX2MY2'],
'argumentCount' => '2',
],
'SUMX2PY2' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUMX2PY2'],
'argumentCount' => '2',
],
'SUMXMY2' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUMXMY2'],
'argumentCount' => '2',
],
'SWITCH' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Logical::class, 'statementSwitch'],
'argumentCount' => '3+',
],
'SYD' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'SYD'],
'argumentCount' => '4',
],
'T' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'RETURNSTRING'],
'argumentCount' => '1',
],
'TAN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'tan',
'argumentCount' => '1',
],
'TANH' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'tanh',
'argumentCount' => '1',
],
'TBILLEQ' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'TBILLEQ'],
'argumentCount' => '3',
],
'TBILLPRICE' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'TBILLPRICE'],
'argumentCount' => '3',
],
'TBILLYIELD' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'TBILLYIELD'],
'argumentCount' => '3',
],
'TDIST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'TDIST'],
'argumentCount' => '3',
],
'TEXT' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'TEXTFORMAT'],
'argumentCount' => '2',
],
'TEXTJOIN' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'TEXTJOIN'],
'argumentCount' => '3+',
],
'TIME' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'TIME'],
'argumentCount' => '3',
],
'TIMEVALUE' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'TIMEVALUE'],
'argumentCount' => '1',
],
'TINV' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'TINV'],
'argumentCount' => '2',
],
'TODAY' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'DATENOW'],
'argumentCount' => '0',
],
'TRANSPOSE' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'TRANSPOSE'],
'argumentCount' => '1',
],
'TREND' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'TREND'],
'argumentCount' => '1-4',
],
'TRIM' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'TRIMSPACES'],
'argumentCount' => '1',
],
'TRIMMEAN' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'TRIMMEAN'],
'argumentCount' => '2',
],
'TRUE' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Logical::class, 'TRUE'],
'argumentCount' => '0',
],
'TRUNC' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'TRUNC'],
'argumentCount' => '1,2',
],
'TTEST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '4',
],
'TYPE' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'TYPE'],
'argumentCount' => '1',
],
'UNICHAR' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'CHARACTER'],
'argumentCount' => '1',
],
'UNICODE' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'ASCIICODE'],
'argumentCount' => '1',
],
'UPPER' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'UPPERCASE'],
'argumentCount' => '1',
],
'USDOLLAR' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2',
],
'VALUE' => [
'category' => Category::CATEGORY_TEXT_AND_DATA,
'functionCall' => [TextData::class, 'VALUE'],
'argumentCount' => '1',
],
'VAR' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'VARFunc'],
'argumentCount' => '1+',
],
'VAR.P' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'VARP'],
'argumentCount' => '1+',
],
'VAR.S' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'VARFunc'],
'argumentCount' => '1+',
],
'VARA' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'VARA'],
'argumentCount' => '1+',
],
'VARP' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'VARP'],
'argumentCount' => '1+',
],
'VARPA' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'VARPA'],
'argumentCount' => '1+',
],
'VDB' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '5-7',
],
'VLOOKUP' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [LookupRef::class, 'VLOOKUP'],
'argumentCount' => '3,4',
],
'WEEKDAY' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'WEEKDAY'],
'argumentCount' => '1,2',
],
'WEEKNUM' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'WEEKNUM'],
'argumentCount' => '1,2',
],
'WEIBULL' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'WEIBULL'],
'argumentCount' => '4',
],
'WORKDAY' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'WORKDAY'],
'argumentCount' => '2+',
],
'XIRR' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'XIRR'],
'argumentCount' => '2,3',
],
'XNPV' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'XNPV'],
'argumentCount' => '3',
],
'XOR' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Logical::class, 'logicalXor'],
'argumentCount' => '1+',
],
'YEAR' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'YEAR'],
'argumentCount' => '1',
],
'YEARFRAC' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'YEARFRAC'],
'argumentCount' => '2,3',
],
'YIELD' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '6,7',
],
'YIELDDISC' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'YIELDDISC'],
'argumentCount' => '4,5',
],
'YIELDMAT' => [
'category' => Category::CATEGORY_FINANCIAL,
'functionCall' => [Financial::class, 'YIELDMAT'],
'argumentCount' => '5,6',
],
'ZTEST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'ZTEST'],
'argumentCount' => '2-3',
],
];
// Internal functions used for special control purposes
private static $controlFunctions = [
'MKMATRIX' => [
'argumentCount' => '*',
'functionCall' => 'self::mkMatrix',
],
];
public function __construct(Spreadsheet $spreadsheet = null)
{
$this->delta = 1 * pow(10, 0 - ini_get('precision'));
$this->spreadsheet = $spreadsheet;
$this->cyclicReferenceStack = new CyclicReferenceStack();
$this->debugLog = new Logger($this->cyclicReferenceStack);
}
private static function loadLocales()
{
$localeFileDirectory = __DIR__ . '/locale/';
foreach (glob($localeFileDirectory . '*', GLOB_ONLYDIR) as $filename) {
$filename = substr($filename, strlen($localeFileDirectory));
if ($filename != 'en') {
self::$validLocaleLanguages[] = $filename;
}
}
}
/**
* Get an instance of this class.
*
* @param Spreadsheet $spreadsheet Injected spreadsheet for working with a PhpSpreadsheet Spreadsheet object,
* or NULL to create a standalone claculation engine
*
* @return Calculation
*/
public static function getInstance(Spreadsheet $spreadsheet = null)
{
if ($spreadsheet !== null) {
$instance = $spreadsheet->getCalculationEngine();
if (isset($instance)) {
return $instance;
}
}
if (!isset(self::$instance) || (self::$instance === null)) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Flush the calculation cache for any existing instance of this class
* but only if a Calculation instance exists.
*/
public function flushInstance()
{
$this->clearCalculationCache();
}
/**
* Get the Logger for this calculation engine instance.
*
* @return Logger
*/
public function getDebugLog()
{
return $this->debugLog;
}
/**
* __clone implementation. Cloning should not be allowed in a Singleton!
*
* @throws Exception
*/
final public function __clone()
{
throw new Exception('Cloning the calculation engine is not allowed!');
}
/**
* Return the locale-specific translation of TRUE.
*
* @return string locale-specific translation of TRUE
*/
public static function getTRUE()
{
return self::$localeBoolean['TRUE'];
}
/**
* Return the locale-specific translation of FALSE.
*
* @return string locale-specific translation of FALSE
*/
public static function getFALSE()
{
return self::$localeBoolean['FALSE'];
}
/**
* Set the Array Return Type (Array or Value of first element in the array).
*
* @param string $returnType Array return type
*
* @return bool Success or failure
*/
public static function setArrayReturnType($returnType)
{
if (($returnType == self::RETURN_ARRAY_AS_VALUE) ||
($returnType == self::RETURN_ARRAY_AS_ERROR) ||
($returnType == self::RETURN_ARRAY_AS_ARRAY)) {
self::$returnArrayAsType = $returnType;
return true;
}
return false;
}
/**
* Return the Array Return Type (Array or Value of first element in the array).
*
* @return string $returnType Array return type
*/
public static function getArrayReturnType()
{
return self::$returnArrayAsType;
}
/**
* Is calculation caching enabled?
*
* @return bool
*/
public function getCalculationCacheEnabled()
{
return $this->calculationCacheEnabled;
}
/**
* Enable/disable calculation cache.
*
* @param bool $pValue
*/
public function setCalculationCacheEnabled($pValue)
{
$this->calculationCacheEnabled = $pValue;
$this->clearCalculationCache();
}
/**
* Enable calculation cache.
*/
public function enableCalculationCache()
{
$this->setCalculationCacheEnabled(true);
}
/**
* Disable calculation cache.
*/
public function disableCalculationCache()
{
$this->setCalculationCacheEnabled(false);
}
/**
* Clear calculation cache.
*/
public function clearCalculationCache()
{
$this->calculationCache = [];
}
/**
* Clear calculation cache for a specified worksheet.
*
* @param string $worksheetName
*/
public function clearCalculationCacheForWorksheet($worksheetName)
{
if (isset($this->calculationCache[$worksheetName])) {
unset($this->calculationCache[$worksheetName]);
}
}
/**
* Rename calculation cache for a specified worksheet.
*
* @param string $fromWorksheetName
* @param string $toWorksheetName
*/
public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName)
{
if (isset($this->calculationCache[$fromWorksheetName])) {
$this->calculationCache[$toWorksheetName] = &$this->calculationCache[$fromWorksheetName];
unset($this->calculationCache[$fromWorksheetName]);
}
}
/**
* Get the currently defined locale code.
*
* @return string
*/
public function getLocale()
{
return self::$localeLanguage;
}
/**
* Set the locale code.
*
* @param string $locale The locale to use for formula translation, eg: 'en_us'
*
* @return bool
*/
public function setLocale($locale)
{
// Identify our locale and language
$language = $locale = strtolower($locale);
if (strpos($locale, '_') !== false) {
list($language) = explode('_', $locale);
}
if (count(self::$validLocaleLanguages) == 1) {
self::loadLocales();
}
// Test whether we have any language data for this language (any locale)
if (in_array($language, self::$validLocaleLanguages)) {
// initialise language/locale settings
self::$localeFunctions = [];
self::$localeArgumentSeparator = ',';
self::$localeBoolean = ['TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL'];
// Default is English, if user isn't requesting english, then read the necessary data from the locale files
if ($locale != 'en_us') {
// Search for a file with a list of function names for locale
$functionNamesFile = __DIR__ . '/locale/' . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'functions';
if (!file_exists($functionNamesFile)) {
// If there isn't a locale specific function file, look for a language specific function file
$functionNamesFile = __DIR__ . '/locale/' . $language . DIRECTORY_SEPARATOR . 'functions';
if (!file_exists($functionNamesFile)) {
return false;
}
}
// Retrieve the list of locale or language specific function names
$localeFunctions = file($functionNamesFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($localeFunctions as $localeFunction) {
list($localeFunction) = explode('##', $localeFunction); // Strip out comments
if (strpos($localeFunction, '=') !== false) {
list($fName, $lfName) = explode('=', $localeFunction);
$fName = trim($fName);
$lfName = trim($lfName);
if ((isset(self::$phpSpreadsheetFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
self::$localeFunctions[$fName] = $lfName;
}
}
}
// Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions
if (isset(self::$localeFunctions['TRUE'])) {
self::$localeBoolean['TRUE'] = self::$localeFunctions['TRUE'];
}
if (isset(self::$localeFunctions['FALSE'])) {
self::$localeBoolean['FALSE'] = self::$localeFunctions['FALSE'];
}
$configFile = __DIR__ . '/locale/' . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'config';
if (!file_exists($configFile)) {
$configFile = __DIR__ . '/locale/' . $language . DIRECTORY_SEPARATOR . 'config';
}
if (file_exists($configFile)) {
$localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($localeSettings as $localeSetting) {
list($localeSetting) = explode('##', $localeSetting); // Strip out comments
if (strpos($localeSetting, '=') !== false) {
list($settingName, $settingValue) = explode('=', $localeSetting);
$settingName = strtoupper(trim($settingName));
switch ($settingName) {
case 'ARGUMENTSEPARATOR':
self::$localeArgumentSeparator = trim($settingValue);
break;
}
}
}
}
}
self::$functionReplaceFromExcel = self::$functionReplaceToExcel =
self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null;
self::$localeLanguage = $locale;
return true;
}
return false;
}
/**
* @param string $fromSeparator
* @param string $toSeparator
* @param string $formula
* @param bool $inBraces
*
* @return string
*/
public static function translateSeparator($fromSeparator, $toSeparator, $formula, &$inBraces)
{
$strlen = mb_strlen($formula);
for ($i = 0; $i < $strlen; ++$i) {
$chr = mb_substr($formula, $i, 1);
switch ($chr) {
case '{':
$inBraces = true;
break;
case '}':
$inBraces = false;
break;
case $fromSeparator:
if (!$inBraces) {
$formula = mb_substr($formula, 0, $i) . $toSeparator . mb_substr($formula, $i + 1);
}
}
}
return $formula;
}
/**
* @param string[] $from
* @param string[] $to
* @param string $formula
* @param string $fromSeparator
* @param string $toSeparator
*
* @return string
*/
private static function translateFormula(array $from, array $to, $formula, $fromSeparator, $toSeparator)
{
// Convert any Excel function names to the required language
if (self::$localeLanguage !== 'en_us') {
$inBraces = false;
// If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators
if (strpos($formula, '"') !== false) {
// So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded
// the formula
$temp = explode('"', $formula);
$i = false;
foreach ($temp as &$value) {
// Only count/replace in alternating array entries
if ($i = !$i) {
$value = preg_replace($from, $to, $value);
$value = self::translateSeparator($fromSeparator, $toSeparator, $value,