Documentation/Calc Functions/FREQUENCY

Function name:
FREQUENCY

Category:
Array

Summary:
Determines the frequency distribution of the data in an input array. FREQUENCY counts the number of values in the input array that are within specified intervals and returns a single-column array containing these counts.

Syntax:
FREQUENCY(Data; Classes)

Returns:
Returns a single-column array of integer values containing the count for each defined interval. The length of this array is one greater than the number of values specified in the second argument.

Arguments:
Data is a reference list specifying the range(s) of cells containing the data for which the frequency distribution is required. These data values need not be ordered. Data takes one of the following forms: Classes is a reference list specifying the intervals for which the frequency distribution is required. It takes one of the same forms as listed above for the Data argument. The following notes provide further information:
 * A single cell range, defined by entering the cell reference for the upper left-hand cell, followed by a colon, and then the lower right-hand cell reference (for example, A1:E10).
 * Multiple cell ranges can be passed as a single argument by providing them in a separated list, surrounded by parentheses – for example, . In this case Calc will reformat your function call to use the tilde reference concatenation operator – for example  . Alternatively, you can use the tilde reference concatenation operator directly without parentheses – for example.
 * A single cell range referenced by the name of a database range (defined by selecting on the Menu bar).
 * One or more cell ranges referenced by the name of a named range. Named ranges defined using on the Menu bar can be configured to comprise multiple areas by using the tilde reference concatenation operator in the Range or formula expression field of the Define Name dialog.
 * An inline array (for example, {1, 2, 3; 4, 5, 6}).
 * While not essential, it is recommended that the values in Classes be organised as a single-column array of cells, vertically aligned with the cells used for the output array. This makes is easier for the user to understand the results from FREQUENCY.
 * It is recommended that the values in Classes be sorted in ascending order, making the outputs easier to understand. FREQUENCY will not report an error if the values are unordered, but the user may have more difficulty interpreting the returned array. The values in the output array are ordered to match the original order of Classes.
 * Assuming that the values in Classes are ordered as suggested:
 * The first element in the returned array is the count of values in Data that are less than or equal to the first value in Classes.
 * The second value in the returned array is the count of values in Data that are greater than the first value in Classes but less than or equal to the second value in Classes.
 * … and so on.
 * The returned array is one entry longer than Classes, with the extra element containing the count of values in Data that are greater than the last value in Classes.

The following conditions may arise:
 * If the cells within Data contain no numbers, then FREQUENCY reports a #VALUE! error.
 * When determining the frequency distribution of the numbers in Data, FREQUENCY ignores any cell that is empty or contains a text string. The logical values TRUE and FALSE are counted as 1 and 0 respectively. Dates and times are treated as numbers, using date-time serial numbers.
 * If the cells within Classes contain no numbers, then FREQUENCY reports a #VALUE! error.
 * In Classes, FREQUENCY ignores any cell that is empty or contains a text string. The logical values TRUE and FALSE are counted as 1 and 0 respectively. Dates and times are treated as numbers, using date-time serial numbers.

Details specific to FREQUENCY function

 * This function ignores any text or empty cells within a data range. If you suspect wrong results from FREQUENCY, look for text in the data ranges. To highlight text contents in a data range, use Calc’s Value Highlighting feature.

Examples:
For these examples, the input data is assumed to be as shown in the following table.

In the above table, the cells with a light blue background are included for information only – they clarify the data displayed but are not processed in the examples of the FREQUENCY function given below. Fifteen students sat an examination and their names and percentage test scores are listed in cells A2:A16 and B2:B16 respectively. Students are assigned to a grade band (listed in cells D2:D7) based on where their percentage test score lies in the intervals specified in cells E2:F7 – students scoring 25% or less are in band E; students with a score in the range [26, 36] are in band D; and so on. The objective of the examples is to calculate the number of students falling within each grade band (cells G2:G7).

Related LibreOffice functions:
None.

ODF standard:
Section 6.18.29, part 2

Equivalent Excel functions:
FREQUENCY