1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|
|
4 |
|
|
|
5 |
/**
|
|
|
6 |
* @deprecated 1.17.0
|
|
|
7 |
*
|
|
|
8 |
* @codeCoverageIgnore
|
|
|
9 |
*/
|
|
|
10 |
class Database
|
|
|
11 |
{
|
|
|
12 |
/**
|
|
|
13 |
* DAVERAGE.
|
|
|
14 |
*
|
|
|
15 |
* Averages the values in a column of a list or database that match conditions you specify.
|
|
|
16 |
*
|
|
|
17 |
* Excel Function:
|
|
|
18 |
* DAVERAGE(database,field,criteria)
|
|
|
19 |
*
|
|
|
20 |
* @deprecated 1.17.0
|
|
|
21 |
* Use the evaluate() method in the Database\DAverage class instead
|
|
|
22 |
* @see Database\DAverage::evaluate()
|
|
|
23 |
*
|
|
|
24 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
25 |
* A database is a list of related data in which rows of related
|
|
|
26 |
* information are records, and columns of data are fields. The
|
|
|
27 |
* first row of the list contains labels for each column.
|
|
|
28 |
* @param int|string $field Indicates which column is used in the function. Enter the
|
|
|
29 |
* column label enclosed between double quotation marks, such as
|
|
|
30 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
31 |
* represents the position of the column within the list: 1 for
|
|
|
32 |
* the first column, 2 for the second column, and so on.
|
|
|
33 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
34 |
* You can use any range for the criteria argument, as long as it
|
|
|
35 |
* includes at least one column label and at least one cell below
|
|
|
36 |
* the column label in which you specify a condition for the
|
|
|
37 |
* column.
|
|
|
38 |
*
|
|
|
39 |
* @return float|string
|
|
|
40 |
*/
|
|
|
41 |
public static function DAVERAGE($database, $field, $criteria)
|
|
|
42 |
{
|
|
|
43 |
return Database\DAverage::evaluate($database, $field, $criteria);
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
/**
|
|
|
47 |
* DCOUNT.
|
|
|
48 |
*
|
|
|
49 |
* Counts the cells that contain numbers in a column of a list or database that match conditions
|
|
|
50 |
* that you specify.
|
|
|
51 |
*
|
|
|
52 |
* Excel Function:
|
|
|
53 |
* DCOUNT(database,[field],criteria)
|
|
|
54 |
*
|
|
|
55 |
* @deprecated 1.17.0
|
|
|
56 |
* Use the evaluate() method in the Database\DCount class instead
|
|
|
57 |
* @see Database\DCount::evaluate()
|
|
|
58 |
*
|
|
|
59 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
60 |
* A database is a list of related data in which rows of related
|
|
|
61 |
* information are records, and columns of data are fields. The
|
|
|
62 |
* first row of the list contains labels for each column.
|
|
|
63 |
* @param null|int|string $field Indicates which column is used in the function. Enter the
|
|
|
64 |
* column label enclosed between double quotation marks, such as
|
|
|
65 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
66 |
* represents the position of the column within the list: 1 for
|
|
|
67 |
* the first column, 2 for the second column, and so on.
|
|
|
68 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
69 |
* You can use any range for the criteria argument, as long as it
|
|
|
70 |
* includes at least one column label and at least one cell below
|
|
|
71 |
* the column label in which you specify a condition for the
|
|
|
72 |
* column.
|
|
|
73 |
*
|
|
|
74 |
* @return int|string
|
|
|
75 |
*
|
|
|
76 |
* @TODO The field argument is optional. If field is omitted, DCOUNT counts all records in the
|
|
|
77 |
* database that match the criteria.
|
|
|
78 |
*/
|
|
|
79 |
public static function DCOUNT($database, $field, $criteria)
|
|
|
80 |
{
|
|
|
81 |
return Database\DCount::evaluate($database, $field, $criteria);
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
/**
|
|
|
85 |
* DCOUNTA.
|
|
|
86 |
*
|
|
|
87 |
* Counts the nonblank cells in a column of a list or database that match conditions that you specify.
|
|
|
88 |
*
|
|
|
89 |
* Excel Function:
|
|
|
90 |
* DCOUNTA(database,[field],criteria)
|
|
|
91 |
*
|
|
|
92 |
* @deprecated 1.17.0
|
|
|
93 |
* Use the evaluate() method in the Database\DCountA class instead
|
|
|
94 |
* @see Database\DCountA::evaluate()
|
|
|
95 |
*
|
|
|
96 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
97 |
* A database is a list of related data in which rows of related
|
|
|
98 |
* information are records, and columns of data are fields. The
|
|
|
99 |
* first row of the list contains labels for each column.
|
|
|
100 |
* @param int|string $field Indicates which column is used in the function. Enter the
|
|
|
101 |
* column label enclosed between double quotation marks, such as
|
|
|
102 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
103 |
* represents the position of the column within the list: 1 for
|
|
|
104 |
* the first column, 2 for the second column, and so on.
|
|
|
105 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
106 |
* You can use any range for the criteria argument, as long as it
|
|
|
107 |
* includes at least one column label and at least one cell below
|
|
|
108 |
* the column label in which you specify a condition for the
|
|
|
109 |
* column.
|
|
|
110 |
*
|
|
|
111 |
* @return int|string
|
|
|
112 |
*/
|
|
|
113 |
public static function DCOUNTA($database, $field, $criteria)
|
|
|
114 |
{
|
|
|
115 |
return Database\DCountA::evaluate($database, $field, $criteria);
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
/**
|
|
|
119 |
* DGET.
|
|
|
120 |
*
|
|
|
121 |
* Extracts a single value from a column of a list or database that matches conditions that you
|
|
|
122 |
* specify.
|
|
|
123 |
*
|
|
|
124 |
* Excel Function:
|
|
|
125 |
* DGET(database,field,criteria)
|
|
|
126 |
*
|
|
|
127 |
* @deprecated 1.17.0
|
|
|
128 |
* Use the evaluate() method in the Database\DGet class instead
|
|
|
129 |
* @see Database\DGet::evaluate()
|
|
|
130 |
*
|
|
|
131 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
132 |
* A database is a list of related data in which rows of related
|
|
|
133 |
* information are records, and columns of data are fields. The
|
|
|
134 |
* first row of the list contains labels for each column.
|
|
|
135 |
* @param int|string $field Indicates which column is used in the function. Enter the
|
|
|
136 |
* column label enclosed between double quotation marks, such as
|
|
|
137 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
138 |
* represents the position of the column within the list: 1 for
|
|
|
139 |
* the first column, 2 for the second column, and so on.
|
|
|
140 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
141 |
* You can use any range for the criteria argument, as long as it
|
|
|
142 |
* includes at least one column label and at least one cell below
|
|
|
143 |
* the column label in which you specify a condition for the
|
|
|
144 |
* column.
|
|
|
145 |
*
|
|
|
146 |
* @return mixed
|
|
|
147 |
*/
|
|
|
148 |
public static function DGET($database, $field, $criteria)
|
|
|
149 |
{
|
|
|
150 |
return Database\DGet::evaluate($database, $field, $criteria);
|
|
|
151 |
}
|
|
|
152 |
|
|
|
153 |
/**
|
|
|
154 |
* DMAX.
|
|
|
155 |
*
|
|
|
156 |
* Returns the largest number in a column of a list or database that matches conditions you that
|
|
|
157 |
* specify.
|
|
|
158 |
*
|
|
|
159 |
* Excel Function:
|
|
|
160 |
* DMAX(database,field,criteria)
|
|
|
161 |
*
|
|
|
162 |
* @deprecated 1.17.0
|
|
|
163 |
* Use the evaluate() method in the Database\DMax class instead
|
|
|
164 |
* @see Database\DMax::evaluate()
|
|
|
165 |
*
|
|
|
166 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
167 |
* A database is a list of related data in which rows of related
|
|
|
168 |
* information are records, and columns of data are fields. The
|
|
|
169 |
* first row of the list contains labels for each column.
|
|
|
170 |
* @param int|string $field Indicates which column is used in the function. Enter the
|
|
|
171 |
* column label enclosed between double quotation marks, such as
|
|
|
172 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
173 |
* represents the position of the column within the list: 1 for
|
|
|
174 |
* the first column, 2 for the second column, and so on.
|
|
|
175 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
176 |
* You can use any range for the criteria argument, as long as it
|
|
|
177 |
* includes at least one column label and at least one cell below
|
|
|
178 |
* the column label in which you specify a condition for the
|
|
|
179 |
* column.
|
|
|
180 |
*
|
|
|
181 |
* @return null|float|string
|
|
|
182 |
*/
|
|
|
183 |
public static function DMAX($database, $field, $criteria)
|
|
|
184 |
{
|
|
|
185 |
return Database\DMax::evaluate($database, $field, $criteria);
|
|
|
186 |
}
|
|
|
187 |
|
|
|
188 |
/**
|
|
|
189 |
* DMIN.
|
|
|
190 |
*
|
|
|
191 |
* Returns the smallest number in a column of a list or database that matches conditions you that
|
|
|
192 |
* specify.
|
|
|
193 |
*
|
|
|
194 |
* Excel Function:
|
|
|
195 |
* DMIN(database,field,criteria)
|
|
|
196 |
*
|
|
|
197 |
* @deprecated 1.17.0
|
|
|
198 |
* Use the evaluate() method in the Database\DMin class instead
|
|
|
199 |
* @see Database\DMin::evaluate()
|
|
|
200 |
*
|
|
|
201 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
202 |
* A database is a list of related data in which rows of related
|
|
|
203 |
* information are records, and columns of data are fields. The
|
|
|
204 |
* first row of the list contains labels for each column.
|
|
|
205 |
* @param int|string $field Indicates which column is used in the function. Enter the
|
|
|
206 |
* column label enclosed between double quotation marks, such as
|
|
|
207 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
208 |
* represents the position of the column within the list: 1 for
|
|
|
209 |
* the first column, 2 for the second column, and so on.
|
|
|
210 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
211 |
* You can use any range for the criteria argument, as long as it
|
|
|
212 |
* includes at least one column label and at least one cell below
|
|
|
213 |
* the column label in which you specify a condition for the
|
|
|
214 |
* column.
|
|
|
215 |
*
|
|
|
216 |
* @return null|float|string
|
|
|
217 |
*/
|
|
|
218 |
public static function DMIN($database, $field, $criteria)
|
|
|
219 |
{
|
|
|
220 |
return Database\DMin::evaluate($database, $field, $criteria);
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
/**
|
|
|
224 |
* DPRODUCT.
|
|
|
225 |
*
|
|
|
226 |
* Multiplies the values in a column of a list or database that match conditions that you specify.
|
|
|
227 |
*
|
|
|
228 |
* Excel Function:
|
|
|
229 |
* DPRODUCT(database,field,criteria)
|
|
|
230 |
*
|
|
|
231 |
* @deprecated 1.17.0
|
|
|
232 |
* Use the evaluate() method in the Database\DProduct class instead
|
|
|
233 |
* @see Database\DProduct::evaluate()
|
|
|
234 |
*
|
|
|
235 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
236 |
* A database is a list of related data in which rows of related
|
|
|
237 |
* information are records, and columns of data are fields. The
|
|
|
238 |
* first row of the list contains labels for each column.
|
|
|
239 |
* @param int|string $field Indicates which column is used in the function. Enter the
|
|
|
240 |
* column label enclosed between double quotation marks, such as
|
|
|
241 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
242 |
* represents the position of the column within the list: 1 for
|
|
|
243 |
* the first column, 2 for the second column, and so on.
|
|
|
244 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
245 |
* You can use any range for the criteria argument, as long as it
|
|
|
246 |
* includes at least one column label and at least one cell below
|
|
|
247 |
* the column label in which you specify a condition for the
|
|
|
248 |
* column.
|
|
|
249 |
*
|
|
|
250 |
* @return float|string
|
|
|
251 |
*/
|
|
|
252 |
public static function DPRODUCT($database, $field, $criteria)
|
|
|
253 |
{
|
|
|
254 |
return Database\DProduct::evaluate($database, $field, $criteria);
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
/**
|
|
|
258 |
* DSTDEV.
|
|
|
259 |
*
|
|
|
260 |
* Estimates the standard deviation of a population based on a sample by using the numbers in a
|
|
|
261 |
* column of a list or database that match conditions that you specify.
|
|
|
262 |
*
|
|
|
263 |
* Excel Function:
|
|
|
264 |
* DSTDEV(database,field,criteria)
|
|
|
265 |
*
|
|
|
266 |
* @deprecated 1.17.0
|
|
|
267 |
* Use the evaluate() method in the Database\DStDev class instead
|
|
|
268 |
* @see Database\DStDev::evaluate()
|
|
|
269 |
*
|
|
|
270 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
271 |
* A database is a list of related data in which rows of related
|
|
|
272 |
* information are records, and columns of data are fields. The
|
|
|
273 |
* first row of the list contains labels for each column.
|
|
|
274 |
* @param int|string $field Indicates which column is used in the function. Enter the
|
|
|
275 |
* column label enclosed between double quotation marks, such as
|
|
|
276 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
277 |
* represents the position of the column within the list: 1 for
|
|
|
278 |
* the first column, 2 for the second column, and so on.
|
|
|
279 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
280 |
* You can use any range for the criteria argument, as long as it
|
|
|
281 |
* includes at least one column label and at least one cell below
|
|
|
282 |
* the column label in which you specify a condition for the
|
|
|
283 |
* column.
|
|
|
284 |
*
|
|
|
285 |
* @return float|string
|
|
|
286 |
*/
|
|
|
287 |
public static function DSTDEV($database, $field, $criteria)
|
|
|
288 |
{
|
|
|
289 |
return Database\DStDev::evaluate($database, $field, $criteria);
|
|
|
290 |
}
|
|
|
291 |
|
|
|
292 |
/**
|
|
|
293 |
* DSTDEVP.
|
|
|
294 |
*
|
|
|
295 |
* Calculates the standard deviation of a population based on the entire population by using the
|
|
|
296 |
* numbers in a column of a list or database that match conditions that you specify.
|
|
|
297 |
*
|
|
|
298 |
* Excel Function:
|
|
|
299 |
* DSTDEVP(database,field,criteria)
|
|
|
300 |
*
|
|
|
301 |
* @deprecated 1.17.0
|
|
|
302 |
* Use the evaluate() method in the Database\DStDevP class instead
|
|
|
303 |
* @see Database\DStDevP::evaluate()
|
|
|
304 |
*
|
|
|
305 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
306 |
* A database is a list of related data in which rows of related
|
|
|
307 |
* information are records, and columns of data are fields. The
|
|
|
308 |
* first row of the list contains labels for each column.
|
|
|
309 |
* @param int|string $field Indicates which column is used in the function. Enter the
|
|
|
310 |
* column label enclosed between double quotation marks, such as
|
|
|
311 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
312 |
* represents the position of the column within the list: 1 for
|
|
|
313 |
* the first column, 2 for the second column, and so on.
|
|
|
314 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
315 |
* You can use any range for the criteria argument, as long as it
|
|
|
316 |
* includes at least one column label and at least one cell below
|
|
|
317 |
* the column label in which you specify a condition for the
|
|
|
318 |
* column.
|
|
|
319 |
*
|
|
|
320 |
* @return float|string
|
|
|
321 |
*/
|
|
|
322 |
public static function DSTDEVP($database, $field, $criteria)
|
|
|
323 |
{
|
|
|
324 |
return Database\DStDevP::evaluate($database, $field, $criteria);
|
|
|
325 |
}
|
|
|
326 |
|
|
|
327 |
/**
|
|
|
328 |
* DSUM.
|
|
|
329 |
*
|
|
|
330 |
* Adds the numbers in a column of a list or database that match conditions that you specify.
|
|
|
331 |
*
|
|
|
332 |
* Excel Function:
|
|
|
333 |
* DSUM(database,field,criteria)
|
|
|
334 |
*
|
|
|
335 |
* @deprecated 1.17.0
|
|
|
336 |
* Use the evaluate() method in the Database\DSum class instead
|
|
|
337 |
* @see Database\DSum::evaluate()
|
|
|
338 |
*
|
|
|
339 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
340 |
* A database is a list of related data in which rows of related
|
|
|
341 |
* information are records, and columns of data are fields. The
|
|
|
342 |
* first row of the list contains labels for each column.
|
|
|
343 |
* @param int|string $field Indicates which column is used in the function. Enter the
|
|
|
344 |
* column label enclosed between double quotation marks, such as
|
|
|
345 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
346 |
* represents the position of the column within the list: 1 for
|
|
|
347 |
* the first column, 2 for the second column, and so on.
|
|
|
348 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
349 |
* You can use any range for the criteria argument, as long as it
|
|
|
350 |
* includes at least one column label and at least one cell below
|
|
|
351 |
* the column label in which you specify a condition for the
|
|
|
352 |
* column.
|
|
|
353 |
*
|
|
|
354 |
* @return null|float|string
|
|
|
355 |
*/
|
|
|
356 |
public static function DSUM($database, $field, $criteria)
|
|
|
357 |
{
|
|
|
358 |
return Database\DSum::evaluate($database, $field, $criteria);
|
|
|
359 |
}
|
|
|
360 |
|
|
|
361 |
/**
|
|
|
362 |
* DVAR.
|
|
|
363 |
*
|
|
|
364 |
* Estimates the variance of a population based on a sample by using the numbers in a column
|
|
|
365 |
* of a list or database that match conditions that you specify.
|
|
|
366 |
*
|
|
|
367 |
* Excel Function:
|
|
|
368 |
* DVAR(database,field,criteria)
|
|
|
369 |
*
|
|
|
370 |
* @deprecated 1.17.0
|
|
|
371 |
* Use the evaluate() method in the Database\DVar class instead
|
|
|
372 |
* @see Database\DVar::evaluate()
|
|
|
373 |
*
|
|
|
374 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
375 |
* A database is a list of related data in which rows of related
|
|
|
376 |
* information are records, and columns of data are fields. The
|
|
|
377 |
* first row of the list contains labels for each column.
|
|
|
378 |
* @param int|string $field Indicates which column is used in the function. Enter the
|
|
|
379 |
* column label enclosed between double quotation marks, such as
|
|
|
380 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
381 |
* represents the position of the column within the list: 1 for
|
|
|
382 |
* the first column, 2 for the second column, and so on.
|
|
|
383 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
384 |
* You can use any range for the criteria argument, as long as it
|
|
|
385 |
* includes at least one column label and at least one cell below
|
|
|
386 |
* the column label in which you specify a condition for the
|
|
|
387 |
* column.
|
|
|
388 |
*
|
|
|
389 |
* @return float|string (string if result is an error)
|
|
|
390 |
*/
|
|
|
391 |
public static function DVAR($database, $field, $criteria)
|
|
|
392 |
{
|
|
|
393 |
return Database\DVar::evaluate($database, $field, $criteria);
|
|
|
394 |
}
|
|
|
395 |
|
|
|
396 |
/**
|
|
|
397 |
* DVARP.
|
|
|
398 |
*
|
|
|
399 |
* Calculates the variance of a population based on the entire population by using the numbers
|
|
|
400 |
* in a column of a list or database that match conditions that you specify.
|
|
|
401 |
*
|
|
|
402 |
* Excel Function:
|
|
|
403 |
* DVARP(database,field,criteria)
|
|
|
404 |
*
|
|
|
405 |
* @deprecated 1.17.0
|
|
|
406 |
* Use the evaluate() method in the Database\DVarP class instead
|
|
|
407 |
* @see Database\DVarP::evaluate()
|
|
|
408 |
*
|
|
|
409 |
* @param mixed[] $database The range of cells that makes up the list or database.
|
|
|
410 |
* A database is a list of related data in which rows of related
|
|
|
411 |
* information are records, and columns of data are fields. The
|
|
|
412 |
* first row of the list contains labels for each column.
|
|
|
413 |
* @param int|string $field Indicates which column is used in the function. Enter the
|
|
|
414 |
* column label enclosed between double quotation marks, such as
|
|
|
415 |
* "Age" or "Yield," or a number (without quotation marks) that
|
|
|
416 |
* represents the position of the column within the list: 1 for
|
|
|
417 |
* the first column, 2 for the second column, and so on.
|
|
|
418 |
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
|
|
419 |
* You can use any range for the criteria argument, as long as it
|
|
|
420 |
* includes at least one column label and at least one cell below
|
|
|
421 |
* the column label in which you specify a condition for the
|
|
|
422 |
* column.
|
|
|
423 |
*
|
|
|
424 |
* @return float|string (string if result is an error)
|
|
|
425 |
*/
|
|
|
426 |
public static function DVARP($database, $field, $criteria)
|
|
|
427 |
{
|
|
|
428 |
return Database\DVarP::evaluate($database, $field, $criteria);
|
|
|
429 |
}
|
|
|
430 |
}
|