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

From Apache OpenOffice Wiki
Jump to: navigation, search
m
m
 
(12 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__
+
{{DISPLAYTITLE:MODE function}}
 +
{{Documentation/CalcFunc StatisticalTOC
 +
|ShowPrevNext=block
 +
|PrevPage=Documentation/How_Tos/Calc:_MEDIAN_function
 +
|NextPage=Documentation/How_Tos/Calc:_TRIMMEAN_function
 +
}}__NOTOC__]
  
 
== MODE ==
 
== MODE ==
Line 13: Line 18:
  
 
: <i>Advanced topic:</i> <tt>'''MODE'''</tt> evaluates its parameters as [[Documentation/How_Tos/Using_Arrays|array formulas]] - see the examples.
 
: <i>Advanced topic:</i> <tt>'''MODE'''</tt> evaluates its parameters as [[Documentation/How_Tos/Using_Arrays|array formulas]] - see the examples.
 +
  
 
=== Example: ===
 
=== Example: ===
Line 20: Line 26:
 
<tt>'''MODE(3; 7; 3; 9; 9; 3; 5; 1; 9; 5)'''</tt>
 
<tt>'''MODE(3; 7; 3; 9; 9; 3; 5; 1; 9; 5)'''</tt>
 
: returns <tt>'''3'''</tt>. The number <tt>'''9'''</tt> occurs the same number of times, but <tt>'''3'''</tt> is smaller.
 
: returns <tt>'''3'''</tt>. The number <tt>'''9'''</tt> occurs the same number of times, but <tt>'''3'''</tt> is smaller.
 +
 +
<tt>'''( -MODE(-A1:A10)=MODE(A1:A10) )'''</tt>
 +
: returns <tt>'''TRUE'''</tt> if there is just one mode for the data in A1:A10, and <tt>'''FALSE'''</tt> otherwise. Notice the two minus signs.
  
  
Line 27: Line 36:
 
: 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>.
 
: 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: ===
 
[[Documentation/How_Tos/Calc: AVERAGE function|'''AVERAGE''']],
 
[[Documentation/How_Tos/Calc: AVERAGEA function|'''AVERAGEA''']],
 
[[Documentation/How_Tos/Calc: MEDIAN function|'''MEDIAN''']]
 
  
[[Documentation/How_Tos/Calc: ABS function|'''ABS''']]
+
{{SeeAlso|EN|
 +
* [[Documentation/How_Tos/Calc: AVERAGE function|AVERAGE]]
 +
* [[Documentation/How_Tos/Calc: AVERAGEA function|AVERAGEA]]
 +
* [[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]]
  
[[Documentation/How_Tos/Using_Arrays|'''Using Arrays''']]
+
* [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]]
 +
* [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}}
 +
[[Category: Documentation/Reference/Calc/Statistical functions]]

Latest revision as of 13:25, 2 February 2024


]

MODE

Returns the most common value in a set of numbers.

Syntax:

MODE(number1; number2; ... number30)

number1 to number30 are up to 30 numbers or ranges/arrays 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.


Advanced topic: MODE evaluates its parameters as array formulas - see the examples.


Example:

MODE(A1:A4)

where cells A1:A4 contain 1, 3, 2, 3 returns 3, the number occurring most often.

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

returns 3. The number 9 occurs the same number of times, but 3 is smaller.

( -MODE(-A1:A10)=MODE(A1:A10) )

returns TRUE if there is just one mode for the data in A1:A10, and FALSE otherwise. Notice the two minus signs.


Advanced topic: Evaluation as an array formula:

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
Retrieved from "https://wiki.openoffice.org/w/index.php?title=Documentation/How_Tos/Calc:_MODE_function&oldid=260019"
Views
Personal tools
Navigation
Tools