@@ 1919-1942 (lines=24) @@ | ||
1916 | * @return float |
|
1917 | * |
|
1918 | */ |
|
1919 | public static function LARGE() { |
|
1920 | $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); |
|
1921 | ||
1922 | // Calculate |
|
1923 | $entry = floor(array_pop($aArgs)); |
|
1924 | ||
1925 | if ((is_numeric($entry)) && (!is_string($entry))) { |
|
1926 | $mArgs = array(); |
|
1927 | foreach ($aArgs as $arg) { |
|
1928 | // Is it a numeric value? |
|
1929 | if ((is_numeric($arg)) && (!is_string($arg))) { |
|
1930 | $mArgs[] = $arg; |
|
1931 | } |
|
1932 | } |
|
1933 | $count = self::COUNT($mArgs); |
|
1934 | $entry = floor(--$entry); |
|
1935 | if (($entry < 0) || ($entry >= $count) || ($count == 0)) { |
|
1936 | return PHPExcel_Calculation_Functions::NaN(); |
|
1937 | } |
|
1938 | rsort($mArgs); |
|
1939 | return $mArgs[$entry]; |
|
1940 | } |
|
1941 | return PHPExcel_Calculation_Functions::VALUE(); |
|
1942 | } // function LARGE() |
|
1943 | ||
1944 | ||
1945 | /** |
|
@@ 2925-2948 (lines=24) @@ | ||
2922 | * @param int $entry Position (ordered from the smallest) in the array or range of data to return |
|
2923 | * @return float |
|
2924 | */ |
|
2925 | public static function SMALL() { |
|
2926 | $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); |
|
2927 | ||
2928 | // Calculate |
|
2929 | $entry = array_pop($aArgs); |
|
2930 | ||
2931 | if ((is_numeric($entry)) && (!is_string($entry))) { |
|
2932 | $mArgs = array(); |
|
2933 | foreach ($aArgs as $arg) { |
|
2934 | // Is it a numeric value? |
|
2935 | if ((is_numeric($arg)) && (!is_string($arg))) { |
|
2936 | $mArgs[] = $arg; |
|
2937 | } |
|
2938 | } |
|
2939 | $count = self::COUNT($mArgs); |
|
2940 | $entry = floor(--$entry); |
|
2941 | if (($entry < 0) || ($entry >= $count) || ($count == 0)) { |
|
2942 | return PHPExcel_Calculation_Functions::NaN(); |
|
2943 | } |
|
2944 | sort($mArgs); |
|
2945 | return $mArgs[$entry]; |
|
2946 | } |
|
2947 | return PHPExcel_Calculation_Functions::VALUE(); |
|
2948 | } // function SMALL() |
|
2949 | ||
2950 | ||
2951 | /** |