Difference between revisions of "Documentation/How Tos/Calc: MODE function"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial content)
 
(added array evaluation information)
Line 10: Line 10:
  
 
: <tt>'''MODE'''</tt> returns the number that occurs most often, or if more than one number occurs that many times, the smallest such number. If no number occurs more than once, <tt>'''MODE'''</tt> returns an error.
 
: <tt>'''MODE'''</tt> returns the number that occurs most often, or if more than one number occurs that many times, the smallest such number. If no number occurs more than once, <tt>'''MODE'''</tt> returns an error.
 +
 +
: <tt>'''MODE'''</tt> is evaluated as an [[Documentation/How_Tos/Using_Arrays|array formula]] - see the examples.
  
 
=== Example: ===
 
=== Example: ===
Line 15: Line 17:
 
<tt>'''MODE(3; 7; 3; 9; 9; 3; 5; 1; 8; 5)'''</tt>
 
<tt>'''MODE(3; 7; 3; 9; 9; 3; 5; 1; 8; 5)'''</tt>
 
: returns <tt>'''3'''</tt>, the number occuring most often.
 
: returns <tt>'''3'''</tt>, the number occuring most often.
 +
 +
<tt>'''MODE(ABS({1; 1; 1; 2; 2; -2; -2}))'''</tt>
 +
: returns <tt>'''2'''</tt>. The <tt>'''ABS'''</tt> function normally takes a single number, but here it is given an array. <tt>'''MODE'''</tt> forces the formula to be an array formula, so that the absolute value of each number in the array is found, and given to <tt>'''MODE'''</tt> as the array {1; 1; 1; 2; 2; 2; 2}. The most common value is now <tt>'''2'''</tt>.
  
 
=== See also: ===
 
=== See also: ===
Line 20: Line 25:
 
[[Documentation/How_Tos/Calc: AVERAGEA function|'''AVERAGEA''']],
 
[[Documentation/How_Tos/Calc: AVERAGEA function|'''AVERAGEA''']],
 
[[Documentation/How_Tos/Calc: MEDIAN function|'''MEDIAN''']]
 
[[Documentation/How_Tos/Calc: MEDIAN function|'''MEDIAN''']]
 +
 +
[[Documentation/How_Tos/Calc: ABS function|'''ABS''']]
  
 
[[Documentation/How_Tos/Calc: Statistical functions|'''Statistical functions''']]
 
[[Documentation/How_Tos/Calc: Statistical functions|'''Statistical functions''']]
 +
 +
[[Documentation/How_Tos/Using_Arrays|'''Using Arrays''']]

Revision as of 18:16, 1 May 2008


MODE

Returns the most common value in a data set.

Syntax:

MODE(number1; number2; ... number30)

number1 to number30 are up to 30 numbers or ranges containing numbers.
MODE returns the number that occurs most often, or if more than one number occurs that many times, the smallest such number. If no number occurs more than once, MODE returns an error.
MODE is evaluated as an array formula - see the examples.

Example:

MODE(3; 7; 3; 9; 9; 3; 5; 1; 8; 5)

returns 3, the number occuring most often.

MODE(ABS({1; 1; 1; 2; 2; -2; -2}))

returns 2. The ABS function normally takes a single number, but here it is given an array. MODE forces the formula to be an array formula, so that the absolute value of each number in the array is found, and given to MODE as the array {1; 1; 1; 2; 2; 2; 2}. The most common value is now 2.

See also:

AVERAGE, AVERAGEA, MEDIAN

ABS

Statistical functions

Using Arrays

Personal tools