How calculate Median

  • Thread starter Thread starter Al
  • Start date Start date
A

Al

I realize that access does not handle median and I need to
write a function for that in a module. I am having hard
time to make a function that works well. Does any one has
some simple code for this.
thanks
Al
 
How about using a query that takes the last record from
50% of the records (sorted of course)?

Air Query:

SELECT Last([MyField]) From
(SELECT TOP 50 PERCENT MyField From tblMyTable
ORDER BY MyField) AS MySubquery

David Atkins, MCP
 
The median is a mathematical middle of a distribution of numbers
(quantities). By definition:
The median is the middle of a distribution: half the scores are above the
median and half are below the median. The median is less sensitive to
extreme scores than the mean and this makes it a better measure than the
mean for highly skewed distributions. The median income is usually more
informative than the mean income, for example.
The sum of the absolute deviations of each number from the median is lower
than is the sum of absolute deviations from any other number. Click here for
an example.

The mean, median, and mode are equal in symmetric distributions. The mean is
higher than the median in positively skewed distributions and lower than the
median in negatively skewed distributions Click here for examples.

Computation of Median
When there is an odd number of numbers, the median is simply the middle
number. For example, the median of 2, 4, and 7 is 4.

When there is an even number of numbers, the median is the mean of the two
middle numbers. Thus, the median of the numbers 2, 4, 7, 12 is (4+7)/2 =
5.5.

OK! so much for definitions. That doesn't answer your question, but it does
give you a goal to approach. Depending on the quantity of numbers you have
in your database and the distribution of those numbers it is difficult to
provide you an answer without more details. There is no specific function
in Access to arrive at a median because the median statistic is so dependent
on the universe of numbers you are working with. I hope the above
definition provides some insight to the problem, how to calculate it and
perhaps how to solve you problem.

Please send more details about your number universe and I may be able to
help you further.

Cheers,

Henry
 
Yes, but the median would be different when you have an
odd number of records than when you have an even number.
in an even number this will not work.I was hoping for a vb
function more or less. any other ideas
thanks
Al
 
Here is another web site that can help you with calculating a median of your
data set. Within the site there is a great discussion and example code for
calculating a median of some data set. The title of the specific median
information is: Calculating Statistical Percentiles in a Query (or Report)
Go to the ACG site and navigate to the group "Code & Design Tips". Then
select "Queries and Record Sets". After you are there scroll down to
Calculating Statistical Percentiles in a Query (or Report) (near the end).
ACG Site http://ourworld.compuserve.com/homepages/attac-cg/

Hope this helps achieve your goal to calculate a median.

Cheers,
Henry
 
Back
Top