From cef07a72b504a83504942eb4cf5b992e1ee46775 Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Sat, 24 Apr 2021 14:32:53 -0300 Subject: [PATCH] tdf#131995 Be precise with Criterion in Calc + Reused and adapted definitions of ODF 1.2 for Criterion in ODFF functions, as suggested in the bug description. Change-Id: I335c6b2b9bd4236071c544cc2ad7f751db75b99f Reviewed-on: https://gerrit.libreoffice.org/c/help/+/114613 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- source/text/scalc/01/04060106.xhp | 2 +- source/text/scalc/01/04060181.xhp | 4 ++-- source/text/scalc/01/ex_data_stat_func.xhp | 26 +++++++++++++++++++--- source/text/scalc/01/func_averageif.xhp | 2 +- source/text/scalc/01/func_countifs.xhp | 2 +- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/source/text/scalc/01/04060106.xhp b/source/text/scalc/01/04060106.xhp index cb34a41899..ae4de417cb 100644 --- a/source/text/scalc/01/04060106.xhp +++ b/source/text/scalc/01/04060106.xhp @@ -1054,7 +1054,7 @@ SUMIF(Range; Criterion [; SumRange]) Range is the range to which the criterion is to be applied. -Criterion is the cell in which the search criterion is shown, or the search criterion itself. If the criterion is written into the formula, it has to be surrounded by double quotes. + SumRange is the range from which values are summed. If this parameter has not been indicated, the values found in the Range are summed. SUMIF supports the reference concatenation operator (~) only in the Criterion parameter, and only if the optional SumRange parameter is not given. diff --git a/source/text/scalc/01/04060181.xhp b/source/text/scalc/01/04060181.xhp index f32cab5e08..4ce586cb68 100644 --- a/source/text/scalc/01/04060181.xhp +++ b/source/text/scalc/01/04060181.xhp @@ -123,9 +123,9 @@

COUNTIF

Returns the number of cells that meet with certain criteria within a cell range. -COUNTIF(Range; Criteria) +COUNTIF(Range; Criterion) Range is the range to which the criteria are to be applied. -Criteria indicates the criteria in the form of a number, an expression or a character string. These criteria determine which cells are counted. + A1:A10 is a cell range containing the numbers 2000 to 2009. Cell B1 contains the number 2006. In cell B2, you enter a formula: diff --git a/source/text/scalc/01/ex_data_stat_func.xhp b/source/text/scalc/01/ex_data_stat_func.xhp index 8a43857384..7981e9191d 100644 --- a/source/text/scalc/01/ex_data_stat_func.xhp +++ b/source/text/scalc/01/ex_data_stat_func.xhp @@ -121,7 +121,7 @@ In all examples below, ranges for calculation contain the row #6, which is ignored because it contains text. -Func_Range; Range1; Criterion1[; Range2; Criterion2][; … ; [Range127; Criterion127]] +Func_Range; Range1; Criterion[; Range2; Criterion2][; … ; [Range127; Criterion127]]
The logical relation between criteria can be defined as logical AND (conjunction). In other words, if and only if all given criteria are met, a value from the corresponding cell of the given Func_Range is taken into calculation.
@@ -130,9 +130,29 @@
Range1 – required argument. It is a range of cells, a name of a named range, or a label of a column or a row, to which the corresponding criterion is to be applied. - Criterion1 – required argument. A string expression representing a logical condition or a cell reference to such string expression. The expression can contain text, numbers, regular expressions or wildcards (if enabled in calculation options). +
+ Criterion: A criterion is a single cell Reference, Number or Text. It is used in comparisons with cell contents. + A reference to an empty cell is interpreted as the numeric value 0. + A matching expression can be: + + + A Number or Logical value. A matching cell content equals the Number or Logical value. + + + A value beginning with a comparator (<, <=, =, >, >=, <>). + For =, if the value is empty it matches empty cells. + For <>, if the value is empty it matches non-empty cells. + For <>, if the value is not empty it matches any cell content except the value, including empty cells. + Note: "=0" does not match empty cells. + For = and <>, if the value is not empty and can not be interpreted as a Number type or one of its subtypes and the property Search criteria = and <> must apply to whole cells is checked, comparison is against the entire cell contents, if unchecked, comparison is against any subpart of the field that matches the criteria. For = and <>, if the value is not empty and can not be interpreted as a Number type or one of its subtypes applies. + + + Other Text value. If the property Search criteria = and <> must apply to whole cells is true, the comparison is against the entire cell contents, if false, comparison is against any subpart of the field that matches the criteria. The expression can contain text, numbers, regular expressions or wildcards (if enabled in calculation options). + + +
Range2 – Optional. Range2 and all the following mean the same as Range1. - Criterion2 – Optional. Criterion2 and all the following mean the same as Criterion1. + Criterion2 – Optional. Criterion2 and all the following mean the same as Criterion.
The function can have up to 255 arguments, meaning that you can specify 127 criteria ranges and criteria for them. diff --git a/source/text/scalc/01/func_averageif.xhp b/source/text/scalc/01/func_averageif.xhp index 592afe6e75..db00a5611a 100644 --- a/source/text/scalc/01/func_averageif.xhp +++ b/source/text/scalc/01/func_averageif.xhp @@ -30,7 +30,7 @@ AVERAGEIF(Range; Criterion [; Average_Range ]) Range – required argument. An array, a name of named range or a label of a column or a row containing numbers for averaging or numbers or text for the condition. -Criterion – required argument. A condition in the form of expression or a cell reference with expression that defines what cells should be used to calculate the mean. The expression can contain text, numbers, regular expressions (if enabled in calculation options) or wildcards (if enabled in calculation options). + Average_Range – optional. It is a range of values for calculating the mean. If the Average_Range is not specified, Range is used for both, the calculation of the mean and the search according to the condition. If Average_Range is specified, the Range is used only for the condition test, while Average_Range is used for the average calculation. diff --git a/source/text/scalc/01/func_countifs.xhp b/source/text/scalc/01/func_countifs.xhp index 2f1192b059..93c2550ebc 100644 --- a/source/text/scalc/01/func_countifs.xhp +++ b/source/text/scalc/01/func_countifs.xhp @@ -30,7 +30,7 @@ -COUNTIFS(Range1; Criterion1[; Range2; Criterion2][; ... ; [Range127; Criterion127]]) +COUNTIFS(Range1; Criterion[; Range2; Criterion2][; ... ; [Range127; Criterion127]]) Range1, Range2, ... and Criterion1, Criterion2, ... must have the same size, otherwise the function returns err:502 - Invalid argument.