User defined domain aggregate functions

K

k2sarah

i would like to create a user defined domain aggregate function such as
calculate the median of a series. ( i would like to be able to do this
without calling on excel)can you tell me how to do this. also, can i
calculate the query by using the query designer. thks
 
A

Allen Browne

Is the median the most frequently occuring value?

If so, you could write a function that gets the COUNT of each value, and
returns the highest count.

There's an example of how to OpenRecordset and use COUNT in a query in the
code at the end of this article:
http://allenbrowne.com/ser-66.html
The example is in the ELSE block.
 
J

John W. Vinson

Is the median the most frequently occuring value?

That would be the Mode not the Median... The median is that value for which
half the values are larger and half smaller; or more precisely, for an odd
number of values the value for which there are equal numbers of greater and
lesser values; for an even number of values, it is usually the mean of the two
values at the middle of the ranking. I'm not sure how ties are generally
handled!

The question has turned up pretty often (345 hits on a Google Groups search);
one of many solutions can be found at

http://www.fabalou.com/Access/Modules/recordset_median.asp


John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top