MEDIAN

MEDIAN(number1 [,number2] [..])

Returns the number in the middle of a set of numbers.

number1The first number.
number2(Optional) The second number.

REMARKS
* The median is the number in the middle of a set of numbers that have been sorted into ascending order (or descending order).
* If there is an odd number of unique numbers in the set, then the number in the middle is returned. See Example 2.
* If there is an even number of unique numbers in the set, then the average of the two numbers in the middle is calculated. See Example 3.
* This function includes hidden cells.
* Arguments that are just numbers are included.
* Arguments that are just numbers passed as text ("3") are included. See Example 15.
* Arguments that are just logical values are included. True evaluates to 1. False evaluates to 0. See Example 16.
* Arguments that are just text will generate a #VALUE! error. See Example 18.
* Arguments that are references to cells containing zeros are included. See Example 9.
* Arguments that are references to cells containing dates are included and the date serial number is used. See Example 12.
* Arguments that are references to cells containing logical values are excluded. See Example 11.
* Arguments that are references to cells containing text are excluded. See Example 10.
* Arguments that are references to cells containing error values will be returned. See Example 14.
* Arguments that are references to empty cells are excluded. See Example 8.
* Arguments that are arrays containing logical values are excluded. See Example 20.
* Arguments that are arrays containing text are excluded. See Example 19.
* You can have a maximum of 255 arguments.
* You can use the AGGREGATE function to exclude hidden cells.
* You can use the AVERAGE function to return the arithmetic mean of a list of numbers.
* You can use the MODE.SNGL function to return the value that occurs most frequently.
* You can use the MEDIANIFS - User Defined Function to return the number in the middle of a set of numbers that satisfies multiple conditions.
* You can use the MEDIANVISIBLE - User Defined Function to exclude hidden cells.
* You can use the MEDIANVISIBLEIFS - User Defined Function to exclude hidden cells.
* For the Microsoft documentation refer to support.microsoft.com
* For the Google documentation refer to support.google.com

 AB
1=MEDIAN(1, 2, 3) = 25
2=MEDIAN(1, 2, 3, 0) = 1.510
3=MEDIAN(4, 1, 3, 2) = 2.515
4=MEDIAN({-4, -1, -3, -2}) = -2.5 
5=MEDIAN(B1:B3) = 100
6=MEDIAN(B1, B2, B3) = 10text
7=MEDIAN(B1, B2, B3, B4) = 10True
8=MEDIAN(B1, B2, B3, B5) = 7.5False
9=MEDIAN(B1, B2, B3, B6) = 10=DATE(2024, 1, 1) = 01 Jan 2024
10=MEDIAN(B1, B2, B3, B7) = 10=10/0 = #DIV/0!
11=MEDIAN(B1, B2, B3, B8) = 10 
12=MEDIAN(B1, B2, B3, B9) = 12.5 
13=MEDIAN(named_range) = 10 
14=MEDIAN(B1, B2, B3, B10) = #DIV/0! 
15=MEDIAN(2, "3") = 2.5 
16=MEDIAN(2, TRUE) = 1.5 
17=MEDIAN(2, FALSE) = 1 
18=MEDIAN(2, "some text") = #VALUE! 
19=MEDIAN({2, "some text"}) = 2 
20=MEDIAN({2, TRUE}) = 2 

1 - What is the number in the middle of the values (1,2,3). 2.
2 - What is the number in the middle of the values (1,2,3,0). Zeros are always included. Between 1 and 2.
3 - What is the number in the middle of the values (4,1,3,2). Between 2 and 3.
4 - What is the number in the middle of the values in the array {-4,-1,-3,-2}. Between -2 and -3.
5 - What is the number in the middle of the values in the range "B1:B3". 10.
6 - What is the number in the middle of the values in the range "B1", "B2", "B3". 10.
7 - What is the number in the middle of the values in the range "B1", "B2", "B3" and "B4". B4 is empty. Empty cells are always excluded. 10.
8 - What is the number in the middle of the values "B1", "B2", "B3" and "B5". B5 is zero so this gets included. Between 5 and 10.
9 - What is the number in the middle of the values "B1", "B2", "B3" and "B6". B6 is text so this gets excluded. 10.
10 - What is the number in the middle of the values "B1", "B2", "B3" and "B7". B7 is a logical value so this is excluded. 10.
11 - What is the number in the middle of the values "B1", "B2", "B3" and "B8". B8 is a logical value so this is excluded. 10.
12 - What is the number in the middle of the values "B1", "B2", "B3" and "B9". B9 is a date so this gets included as a date serial number. Between 10 and 15.
13 - What is the number in the middle of the values in the named range that refers to "B1:B3". Same as Example 6. 10.
14 - What is the number in the middle of the values in the range "B1", "B2", "B3" and "B10". B10 contains an error so that gets returned. 10.
15 - What is the number in the middle of these values (2, "3"). Text values that are actually numbers are included. Between 2 and 3.
16 - What is the number in the middle of these values (2, TRUE). Logical values passed as arguments are included. TRUE is replaced with 1. Between 1 and 2.
17 - What is the number in the middle of these values (2, FALSE). Logical values passed as arguments are included. FALSE is replaced with 0. Between 0 and 2.
18 - What is the number in the middle of these values (2, "some text"). Text values passed as arguments generate an error.
19 - What is the number in the middle of the values in the array {2. "some text"}. Text values inside arrays are excluded. 2.
20 - What is the number in the middle of the values in the array {2, TRUE}. Logical values inside arrays are excluded. 2.

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top