Results 1 to 4 of 4

Thread: Median /Dmedian

  1. #1
    Join Date
    Sep 2003
    Location
    New York
    Posts
    3

    Unanswered: Median /Dmedian

    Hi

    I'm trying to create a query which calculates medians. The source is simply a list of numbers (field 2), grouped into several different categories (field 1). I want to find the median for each category.

    I've been searching around for help with this query, but everything I've found seems to involve huge amounts of code, which isn't exactly one of my strenghths. Does anyone know of a simple way of programming this query, preferably using either the query window or sql?

    Thanks,

    Havana

  2. #2
    Join Date
    Jul 2003
    Posts
    25
    Can you post part of the table or query? I'm not quite sure how you have your numbers arranged with your categories. If not, give an example of a few entries in your table so I can determine the structure.

  3. #3
    Join Date
    Sep 2003
    Location
    New York
    Posts
    3
    It's a recordset from a query. It has 2 columns - Grade and AIS.

    Grade AIS
    1.2 0.43
    1.2 1.7
    1.2 6.89
    1.5 0.6
    1.5 78
    1.5 25.6
    1.5 45
    1.8 5.6
    1.8 4.58
    1.8 11
    2.5 0.6
    2.5 0.8
    2.5 8.5
    etc etc

    Thanks!

  4. #4
    Join Date
    Apr 2004
    Posts
    5

    Median with Access SQL

    Something like the code below has worked well for me. And the nice thing is that it's all done in SQL.

    SELECT LAST(Number)
    FROM (SELECT TOP 50 PERCENT Number
    FROM tblList
    WHERE Number<>''
    ORDER BY Number);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •