# Statistical Functions Part One

## COUNTIFS

Returns the count of cells that meet criteria in multiple ranges.

\<bookmark_value\>INTERCEPT function\</bookmark_value\>\<bookmark_value\>points of intersection\</bookmark_value\>\<bookmark_value\>intersections\</bookmark_value\>

## INTERCEPT

Calculates the point at which a line will intersect the y-values by using known x-values and y-values.

#### Syntax

INTERCEPT(data_Y; data_X)

\<emph\>Data_Y\</emph\> is the dependent set of observations or data.

\<emph\>Data_X\</emph\> is the independent set of observations or data.

Names, arrays or references containing numbers must be used here. Numbers can also be entered directly.

#### Example

To calculate the intercept, use cells D3:D9 as the y value and C3:C9 as the x value from the example spreadsheet. Input will be as follows:

INTERCEPT(D3:D9;C3:C9) = 2.15.

\<bookmark_value\>COUNT function\</bookmark_value\>\<bookmark_value\>numbers;counting\</bookmark_value\>

## COUNT

Counts how many numbers are in the list of arguments. Text entries are ignored.

#### Syntax

COUNT(Value1; Value2; ...; Value30)

Value1; Value2, ..., Value30 are 1 to 30 values or ranges representing the values to be counted.

#### Example

The entries \<emph\>2, 4, 6\</emph\> and \<emph\>eight\</emph\> in the \<emph\>value 1 - 4\</emph\> fields are to be counted.

COUNT(2;4;6;"eight") = 3. The count of numbers is therefore \<emph\>3\</emph\>.

\<bookmark_value\>COUNTA function\</bookmark_value\>\<bookmark_value\>number of entries\</bookmark_value\>

## COUNTA

Counts how many values are in the list of arguments. Text entries are also counted, even when they contain an empty string of length 0. If an argument is an array or reference, empty cells within the array or reference are ignored.

#### Syntax

COUNTA(Value1; Value2; ...; Value30)

Value1; Value2, ..., Value30 are 1 to 30 arguments representing the values to be counted.

#### Example

The entries \<emph\>2, 4, 6\</emph\> and \<emph\>eight\</emph\> in the \<emph\>value 1 - 4\</emph\> fields are to be counted.

COUNTA(2;4;6;"eight") = 4. The count of values is therefore \<emph\>4\</emph\>.

Returns the beta function.

#### Syntax

\<emph\>Number\</emph\> is the value between \<emph\>Start\</emph\> and \<emph\>End\</emph\> at which to evaluate the function.

\<emph\>Alpha\</emph\> is a parameter to the distribution.

\<emph\>Beta\</emph\> is a parameter to the distribution.

\<emph\>Start\</emph\> (optional) is the lower bound for \<emph\>number\</emph\>.

\<emph\>End\</emph\> (optional) is the upper bound for \<emph\>number\</emph\>.

Cumulative (optional) can be 0 or False to calculate the probability density function. It can be any other value or True or omitted to calculate the cumulative distribution function.

In the LibreOffice Calc functions, parameters marked as "optional" can be left out only when no parameter follows. For example, in a function with four parameters, where the last two parameters are marked as "optional", you can leave out parameter 4 or parameters 3 and 4, but you cannot leave out parameter 3 alone.

#### Example

Returns the beta function. This function is available since LibreOffice 4.2

#### Syntax

BETA.DIST(Number; Alpha; Beta; Cumulative; Start; End)

\<emph\>Number\</emph\> is the value between \<emph\>Start\</emph\> and \<emph\>End\</emph\> at which to evaluate the function.

\<emph\>Alpha\</emph\> is a parameter to the distribution.

\<emph\>Beta\</emph\> is a parameter to the distribution.

Cumulative (required) can be 0 or False to calculate the probability density function. It can be any other value or True to calculate the cumulative distribution function.

\<emph\>Start\</emph\> (optional) is the lower bound for \<emph\>number\</emph\>.

\<emph\>End\</emph\> (optional) is the upper bound for \<emph\>number\</emph\>.

In the LibreOffice Calc functions, parameters marked as "optional" can be left out only when no parameter follows. For example, in a function with four parameters, where the last two parameters are marked as "optional", you can leave out parameter 4 or parameters 3 and 4, but you cannot leave out parameter 3 alone.

#### Example

=BETADIST(0.75; 3; 4) returns the value 0.96

=BETADIST(0.75; 3; 4) returns the value 0.96

\<bookmark_value\>EXPONDIST function\</bookmark_value\>\<bookmark_value\>exponential distributions\</bookmark_value\>

## EXPONDIST

Returns the exponential distribution.

#### Syntax

EXPONDIST(Number; lambda; C)

\<emph\>Number\</emph\> is the value of the function.

\<emph\>Lambda\</emph\> is the parameter value.

\<emph\>C\</emph\> is a logical value that determines the form of the function. \<emph\>C = 0\</emph\> calculates the density function, and \<emph\>C = 1\</emph\> calculates the distribution.

#### Example

=EXPONDIST(3; 0.5; 1) returns 0.78.

\<bookmark_value\>EXPONDIST function\</bookmark_value\>\<bookmark_value\>exponential distributions\</bookmark_value\>

## EXPONDIST

Returns the exponential distribution. This function is available since LibreOffice 4.2

#### Syntax

EXPONDIST(Number; lambda; C)

\<emph\>Number\</emph\> is the value of the function.

\<emph\>Lambda\</emph\> is the parameter value.

\<emph\>C\</emph\> is a logical value that determines the form of the function. \<emph\>C = 0\</emph\> calculates the density function, and \<emph\>C = 1\</emph\> calculates the distribution.

#### Example

=EXPONDIST(3; 0.5; 1) returns 0.78.

\<bookmark_value\>BINOMDIST function\</bookmark_value\>

## BINOMDIST

Returns the individual term binomial distribution probability.

#### Syntax

BINOMDIST(X;trials;SP;C)

\<emph\>X\</emph\> is the number of successes in a set of trials.

\<emph\>Trials\</emph\> is the number of independent trials.

\<emph\>SP\</emph\> is the probability of success on each trial.

\<emph\>C\</emph\> = 0 calculates the probability of a single event and \<emph\>C\</emph\> = 1 calculates the cumulative probability.

#### Example

=BINOMDIST(A1; 12; 0.5; 0) shows (if the values 0 to 12 are entered in A1) the probabilities for 12 flips of a coin that \<emph\>Heads\</emph\> will come up exactly the number of times entered in A1.

=BINOMDIST(A1; 12; 0.5; 1) shows the cumulative probabilities for the same series. For example, if A1 = 4, the cumulative probability of the series is 0, 1, 2, 3 or 4 times \<emph\>Heads\</emph\> (non-exclusive OR).

\<bookmark_value\>BINOMDIST function\</bookmark_value\>

## BINOMDIST

Returns the individual term binomial distribution probability. This function is available since LibreOffice 4.2

#### Syntax

BINOMDIST(X;trials;SP;C)

\<emph\>X\</emph\> is the number of successes in a set of trials.

\<emph\>Trials\</emph\> is the number of independent trials.

\<emph\>SP\</emph\> is the probability of success on each trial.

\<emph\>C\</emph\> = 0 calculates the probability of a single event and \<emph\>C\</emph\> = 1 calculates the cumulative probability.

#### Example

=BINOMDIST(A1; 12; 0.5; 0) shows (if the values 0 to 12 are entered in A1) the probabilities for 12 flips of a coin that \<emph\>Heads\</emph\> will come up exactly the number of times entered in A1.

=BINOMDIST(A1; 12; 0.5; 1) shows the cumulative probabilities for the same series. For example, if A1 = 4, the cumulative probability of the series is 0, 1, 2, 3 or 4 times \<emph\>Heads\</emph\> (non-exclusive OR).

\<bookmark_value\>CHIINV function\</bookmark_value\>

## CHIINV

Returns the inverse of CHISQDIST.

#### Syntax

\<emph\>Number\</emph\> is the probability value for which the inverse Gamma distribution is to be calculated.

\<emph\>Degrees_freedom\</emph\> is the degrees of freedom of the experiment.

\<bookmark_value\>BETAINV function\</bookmark_value\>\<bookmark_value\>cumulative probability density function;inverse of\</bookmark_value\>

## BETAINV

Returns the inverse of the cumulative beta probability density function.

#### Syntax

BETAINV(Number;Alpha;Beta;Start;End)

\<emph\>Number\</emph\> is the value between \<emph\>Start\</emph\> and \<emph\>End\</emph\> at which to evaluate the function.

\<emph\>Alpha\</emph\> is a parameter to the distribution.

\<emph\>Beta\</emph\> is a parameter to the distribution.

\<emph\>Start\</emph\> (optional) is the lower bound for \<emph\>number\</emph\>.

\<emph\>End\</emph\> (optional) is the upper bound for \<emph\>number\</emph\>.

In the LibreOffice Calc functions, parameters marked as "optional" can be left out only when no parameter follows. For example, in a function with four parameters, where the last two parameters are marked as "optional", you can leave out parameter 4 or parameters 3 and 4, but you cannot leave out parameter 3 alone.

#### Example

=BETAINV(0.5; 5; 10) returns the value 0.33.

\<bookmark_value\>BETAINV function\</bookmark_value\>\<bookmark_value\>cumulative probability density function;inverse of\</bookmark_value\>

## BETAINV

Returns the inverse of the cumulative beta probability density function. This function is available since LibreOffice 4.2

#### Syntax

BETAINV(Number;Alpha;Beta;Start;End)

\<emph\>Number\</emph\> is the value between \<emph\>Start\</emph\> and \<emph\>End\</emph\> at which to evaluate the function.

\<emph\>Alpha\</emph\> is a parameter to the distribution.

\<emph\>Beta\</emph\> is a parameter to the distribution.

\<emph\>Start\</emph\> (optional) is the lower bound for \<emph\>number\</emph\>.

\<emph\>End\</emph\> (optional) is the upper bound for \<emph\>number\</emph\>.

In the LibreOffice Calc functions, parameters marked as "optional" can be left out only when no parameter follows. For example, in a function with four parameters, where the last two parameters are marked as "optional", you can leave out parameter 4 or parameters 3 and 4, but you cannot leave out parameter 3 alone.

#### Example

=BETAINV(0.5; 5; 10) returns the value 0.33.

\<bookmark_value\>CHIINV function\</bookmark_value\>

## CHIINV

Returns the inverse of the left-tailed probability of the chi-square distribution. This function is available since LibreOffice 4.2

#### Syntax

CHISQ.INV(Probability; DegreesFreedom)

\<emph\>Number\</emph\> is the probability value for which the inverse Gamma distribution is to be calculated.

\<emph\>Degrees_freedom\</emph\> is the degrees of freedom of the experiment.

#### Example

=CHIINV(0.05; 5) returns 11.07.

\<bookmark_value\>CHIINV function\</bookmark_value\>

## CHIINV

Returns the inverse of the one-tailed probability of the chi-squared distribution.

#### Syntax

CHIINV(number; degrees_freedom)

\<emph\>Number\</emph\> is the value of the error probability.

\<emph\>Degrees_freedom\</emph\> is the degrees of freedom of the experiment.

#### Example

A die is thrown 1020 times. The numbers on the die 1 through 6 come up 195, 151, 148, 189, 183 and 154 times (observation values). The hypothesis that the die is not fixed is to be tested.

The Chi square distribution of the random sample is determined by the formula given above. Since the expected value for a given number on the die for n throws is n times 1/6, thus 1020/6 = 170, the formula returns a Chi square value of 13.27.

If the (observed) Chi square is greater than or equal to the (theoretical) Chi square CHIINV, the hypothesis will be discarded, since the deviation between theory and experiment is too great. If the observed Chi square is less that CHIINV, the hypothesis is confirmed with the indicated probability of error.

=CHIINV(0.05; 5) returns 11.07.

=CHIINV(0.02; 5) returns 13.39.

If the probability of error is 5%, the die is not true. If the probability of error is 2%, there is no reason to believe it is fixed.

\<bookmark_value\>CHIINV function\</bookmark_value\>

## CHIINV

Returns the inverse of the one-tailed probability of the chi-squared distribution. This function is available since LibreOffice 4.2

#### Syntax

CHIINV(number; degrees_freedom)

\<emph\>Number\</emph\> is the value of the error probability.

\<emph\>Degrees_freedom\</emph\> is the degrees of freedom of the experiment.

#### Example

A die is thrown 1020 times. The numbers on the die 1 through 6 come up 195, 151, 148, 189, 183 and 154 times (observation values). The hypothesis that the die is not fixed is to be tested.

The Chi square distribution of the random sample is determined by the formula given above. Since the expected value for a given number on the die for n throws is n times 1/6, thus 1020/6 = 170, the formula returns a Chi square value of 13.27.

If the (observed) Chi square is greater than or equal to the (theoretical) Chi square CHIINV, the hypothesis will be discarded, since the deviation between theory and experiment is too great. If the observed Chi square is less that CHIINV, the hypothesis is confirmed with the indicated probability of error.

=CHIINV(0.05; 5) returns 11.07.

=CHIINV(0.02; 5) returns 13.39.

If the probability of error is 5%, the die is not true. If the probability of error is 2%, there is no reason to believe it is fixed.

\<bookmark_value\>COUNTIF function\</bookmark_value\>\<bookmark_value\>counting;specified cells\</bookmark_value\>

## COUNTIF

Returns the number of cells that meet with certain criteria within a cell range.

#### Syntax

COUNTIF(range; criteria)

\<emph\>Range\</emph\> 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.

The search supports wildcards or regular expressions. With regular expressions enabled, you can enter "all.*", for example to find the first location of "all" followed by any characters. If you want to search for a text that is also a regular expression, you must either precede every character with a "\" character, or enclose the text into \Q...\E. You can switch the automatic evaluation of wildcards or regular expression on and off in - LibreOffice Calc - Calculate. When using functions where one or more arguments are search criteria strings that represents a regular expression, the first attempt is to convert the string criteria to numbers. For example, ".0" will convert to 0.0 and so on. If successful, the match will not be a regular expression match but a numeric match. However, when switching to a locale where the decimal separator is not the dot makes the regular expression conversion work. To force the evaluation of the regular expression instead of a numeric expression, use some expression that can not be misread as numeric, such as "." or ".\0" or "(?i).0".

#### Example

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:

=COUNTIF(A1:A10;2006) - this returns 1.

=COUNTIF(A1:A10;B1) - this returns 1.

=COUNTIF(A1:A10;">=2006") - this returns 4.

=COUNTIF(A1:A10;"<"&B1) - when B1 contains 2006, this returns 6.

=COUNTIF(A1:A10;C2) where cell C2 contains the text >2006 counts the number of cells in the range A1:A10 which are >2006.

To count only negative numbers: COUNTIF(A1:A10;"<0")

\<bookmark_value\>COUNTBLANK function\</bookmark_value\>\<bookmark_value\>counting;empty cells\</bookmark_value\>\<bookmark_value\>empty cells;counting\</bookmark_value\>

## COUNTBLANK

Returns the number of empty cells.

#### Syntax

COUNTBLANK(range)

\<emph\>range\</emph\> is the cell range in which the empty cells are counted.

#### Example

Entering = COUNTBLANK (A1:C3) in an empty cell range results in 9.

\<bookmark_value\>CHIDIST function\</bookmark_value\>

## CHIDIST

Returns the probability density function or the cumulative distribution function for the chi-square distribution. This function is available since LibreOffice 4.2

#### Syntax

TDIST(Number; Degrees_freedom; Mode)

\<emph\>Number\</emph\> is the chi-square value of the random sample used to determine the error probability.

\<emph\>Degrees_freedom\</emph\> are the degrees of freedom of the experiment.

Cumulative can be 0 or False to calculate the probability density function. It can be any other value or True to calculate the cumulative distribution function.

#### Example

=CHISQ.DIST(3; 2; 0) equals 0.1115650801, the probability density function with 2 degrees of freedom, at x = 3.

=CHISQ.DIST(3; 2; 1) equals 0.7768698399, the cumulative chi-square distribution with 2 degrees of freedom, at the value x = 3.

\<bookmark_value\>CHITEST function\</bookmark_value\>

## CHIDIST

Returns the probability of a deviance from a random distribution of two test series based on the chi-squared test for independence. CHISQ.TEST returns the chi-squared distribution of the data.

The probability determined by CHITEST can also be determined with CHIDIST, in which case the Chi square of the random sample must then be passed as a parameter instead of the data row. This function is available since LibreOffice 4.2

#### Syntax

CHITEST(Data_B; Data_E)

\<emph\>Data_B\</emph\> is the array of the observations.

\<emph\>Data_E\</emph\> is the range of the expected values.

#### Example

 Data_B (observed) Data_E (expected) 1 195 170 2 151 170 3 148 170 4 189 170 5 183 170 6 154 170

=CHITEST(A1:A6; B1:B6) equals 0.02. This is the probability which suffices the observed data of the theoretical Chi-square distribution.

\<bookmark_value\>CHITEST function\</bookmark_value\>

## CHITEST

Returns the probability of a deviance from a random distribution of two test series based on the chi-squared test for independence. CHITEST returns the chi-squared distribution of the data.

The probability determined by CHITEST can also be determined with CHIDIST, in which case the Chi square of the random sample must then be passed as a parameter instead of the data row.

#### Syntax

CHITEST(Data_B; Data_E)

\<emph\>Data_B\</emph\> is the array of the observations.

\<emph\>Data_E\</emph\> is the range of the expected values.

#### Example

 Data_B (observed) Data_E (expected) 1 195 170 2 151 170 3 148 170 4 189 170 5 183 170 6 154 170

=CHITEST(A1:A6; B1:B6) equals 0.02. This is the probability which suffices the observed data of the theoretical Chi-square distribution.

\<bookmark_value\>B function\</bookmark_value\>\<bookmark_value\>probabilities of samples with binomial distribution\</bookmark_value\>

## B

Returns the probability of a sample with binomial distribution.

#### Syntax

B(trials;SP;T_1;T_2)

\<emph\>Trials\</emph\> is the number of independent trials.

\<emph\>SP\</emph\> is the probability of success on each trial.

\<emph\>T_1\</emph\> defines the lower limit for the number of trials.

\<emph\>T_2\</emph\> (optional) defines the upper limit for the number of trials.

#### Example

What is the probability with ten throws of the dice, that a six will come up exactly twice? The probability of a six (or any other number) is 1/6. The following formula combines these factors:

=B(10; 1/6; 2) returns a probability of 29%.

\<bookmark_value\>CHIDIST function\</bookmark_value\>

## CHIDIST

Returns the probability value from the indicated Chi square that a hypothesis is confirmed. CHIDIST compares the Chi square value to be given for a random sample that is calculated from the sum of (observed value-expected value)^2/expected value for all values with the theoretical Chi square distribution and determines from this the probability of error for the hypothesis to be tested.

The probability determined by CHIDIST can also be determined by CHITEST.

#### Syntax

CHIDIST (Number; degrees_freedom)

\<emph\>Number\</emph\> is the chi-square value of the random sample used to determine the error probability.

\<emph\>Degrees_freedom\</emph\> are the degrees of freedom of the experiment.

#### Example

=CHIDIST(13.27; 5) equals 0.02.

If the Chi square value of the random sample is 13.27 and if the experiment has 5 degrees of freedom, then the hypothesis is assured with a probability of error of 2%.

\<bookmark_value\>CHIDIST function\</bookmark_value\>

## CHIDIST

Returns the probability value from the indicated Chi square that a hypothesis is confirmed. CHISQ.DIST.RT compares the Chi square value to be given for a random sample that is calculated from the sum of (observed value-expected value)^2/expected value for all values with the theoretical Chi square distribution and determines from this the probability of error for the hypothesis to be tested.

The probability determined by CHIDIST can also be determined by CHITEST. This function is available since LibreOffice 4.2

#### Syntax

CHIDIST (Number; degrees_freedom)

\<emph\>Number\</emph\> is the chi-square value of the random sample used to determine the error probability.

\<emph\>Degrees_freedom\</emph\> are the degrees of freedom of the experiment.

#### Example

=CHIDIST(13.27; 5) equals 0.02.

If the Chi square value of the random sample is 13.27 and if the experiment has 5 degrees of freedom, then the hypothesis is assured with a probability of error of 2%.

\<bookmark_value\>BINOMDIST function\</bookmark_value\>

## BINOM.INV

Returns the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value. This function is available since LibreOffice 4.2

#### Syntax

BINOM.INV(Trials; SP; Alpha)

\<emph\>Trials\</emph\> is the total number of trials.

\<emph\>SP\</emph\> is the probability of success on each trial.

Alpha The border probability that is attained or exceeded.

#### Example

=BINOM.INV(8;0.6;0.9) returns 7, the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value.

\<bookmark_value\>RSQ function\</bookmark_value\>\<bookmark_value\>determination coefficients\</bookmark_value\>\<bookmark_value\>regression analysis\</bookmark_value\>

## RSQ

Returns the square of the Pearson correlation coefficient based on the given values. RSQ (also called determination coefficient) is a measure for the accuracy of an adjustment and can be used to produce a regression analysis.

#### Syntax

RSQ(Data_Y; Data_X)

\<emph\>Data_Y\</emph\> is an array or range of data points.

\<emph\>Data_X\</emph\> is an array or range of data points.

#### Example

=RSQ(A1:A20; B1:B20) calculates the correlation coefficient for both data sets in columns A and B.

\<bookmark_value\>NEGBINOMDIST function\</bookmark_value\>\<bookmark_value\>negative binomial distribution\</bookmark_value\>

## CHIDIST

Returns the value of the probability density function or the cumulative distribution function for the chi-square distribution.

#### Syntax

TDIST(Number; Degrees_freedom; Mode)

\<emph\>Number\</emph\> is the value for which the F distribution is to be calculated.

\<emph\>Degrees_freedom\</emph\> is the degrees of freedom of the experiment.

Cumulative (optional): 0 or False calculates the probability density function. Other values or True or omitted calculates the cumulative distribution function.