XL: Algorithm Used for QUARTILE() Function

Last reviewed: February 2, 1998
Article ID: Q103493
The information in this article applies to:
  • Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c
  • Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a
  • Microsoft Excel for Windows NT, version 5.0
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a
  • Microsoft Excel 97 for Windows
  • Microsoft Excel 98 Macintosh Edition

SUMMARY

In Microsoft Excel, the QUARTILE() function returns a specified quartile in an array of numeric values. QUARTILE() accepts 2 arguments: Array and Quart. Array is the range of values for which you want to find the quartile value. Quart indicates the value you want to return, where:

  0   Minimum value (Same as MIN())
  1   1st quartile - 25th percentile
  2   2nd quartile - 50th percentile (Same as MEDIAN())
  3   3rd quartile - 75th percentile
  4   4th quartile - 100th percentile (Same as MAX())

Note that in Microsoft Excel versions 5.0 and later, you can use the Function Wizard to insert the QUARTILE() function, by clicking Function on the Insert menu. The Function Wizard gives you information about the function, as well as required and optional arguments.

MORE INFORMATION

Following is the algorithm used to calculate QUARTILE():

  1. Find the kth smallest member in the array of values, where:

           k=(quart/4)*(n-1))+1
    

    If k is not an integer, truncate it but store the fractional portion (f) for use in step 3.

        quart = value between 0 and 4 depending on which quartile
    
                you want to find.
    
        n     = number of values in the array
    
    

  2. Find the smallest data point in the array of values that is greater than the kth smallest, the (k+1)th smallest member.

  3. Interpolate between the kth smallest and the (k+1)th smallest values:

          Output = a[k]+(f*(a[k+1]-a[k]))
    

          a[k]   = the kth smallest
          a[k+1] = the k+1th smallest
    
    

Example

To find the 3rd quartile in the array of values, 0,2,3,5,6,8,9, follow these steps:

  1. Find k and f:

          k=TRUNC((3/4*(7-1))+1)=5
          f=(3/4*(7-1))-TRUNC(3/4*(7-1))=.5
    

  2. The 5th (kth) smallest value is 6, and the (5+1)th smallest value is 8.

  3. Interpolate:

          6+(.5*(8-6))=7
    

REFERENCES

"Function Reference," version 4.0, pages 342-343


Additional query words: 4.00 4.00a 5.00 5.00a 5.00c 7.00 7.00a 97 98 XL98
XL97 XL7 XL5 XL4
Version : WINDOWS:4.0,4.0a,5.0,5.0c,7.0,97; MACINTOSH:4.0,5.0,98
Platform : MACINTOSH WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.