See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 and 403]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Calculation\Database; 4 5 use PhpOffice\PhpSpreadsheet\Calculation\MathTrig; 6 7 class DSum extends DatabaseAbstract 8 { 9 /** 10 * DSUM. 11 * 12 * Adds the numbers in a column of a list or database that match conditions that you specify. 13 * 14 * Excel Function: 15 * DSUM(database,field,criteria) 16 * 17 * @param mixed[] $database The range of cells that makes up the list or database. 18 * A database is a list of related data in which rows of related 19 * information are records, and columns of data are fields. The 20 * first row of the list contains labels for each column. 21 * @param int|string $field Indicates which column is used in the function. Enter the 22 * column label enclosed between double quotation marks, such as 23 * "Age" or "Yield," or a number (without quotation marks) that 24 * represents the position of the column within the list: 1 for 25 * the first column, 2 for the second column, and so on. 26 * @param mixed[] $criteria The range of cells that contains the conditions you specify. 27 * You can use any range for the criteria argument, as long as it 28 * includes at least one column label and at least one cell below 29 * the column label in which you specify a condition for the 30 * column. 31 * 32 * @return null|float|string 33 */ 34 public static function evaluate($database, $field, $criteria) 35 { 36 $field = self::fieldExtract($database, $field); 37 if ($field === null) { 38 return null; 39 } 40 41 return MathTrig\Sum::sumIgnoringStrings( 42 self::getFilteredColumn($database, $field, $criteria) 43 ); 44 } 45 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body