PDA

View Full Version : Calculate median of a recordset



dhartford
10-01-2008, 05:43 PM
When calculating median of a recordset, do I need to sort the recordset first, or the median fuction will index the recordset then figure out?

Thanks.

CreganTur
10-02-2008, 05:19 AM
What kind of recordset are you working with- ADO, DAO, an array, or something else?

I'm not aware of a 'median' function in VBA. There is an article here (http://www.anthony-vba.kefra.com/vba/excelvba-statistics.htm) that shows a UDF that calculates the median of an array.

If this doesn't help, then please provide more information of exactly what you're wanting to do.

dhartford
10-02-2008, 07:41 AM
What kind of recordset are you working with- ADO, DAO, an array, or something else?

I'm not aware of a 'median' function in VBA. There is an article here (http://www.anthony-vba.kefra.com/vba/excelvba-statistics.htm) that shows a UDF that calculates the median of an array.

If this doesn't help, then please provide more information of exactly what you're wanting to do.

Thanks for your reply.

It is an ADO recordset with 5 - 6 records. I need to calculate median for of the fields.

CreganTur
10-02-2008, 08:09 AM
Take a look at this article (http://support.microsoft.com/kb/210581). It shows how to find the median in a DAO connection. It shouldn't be too hard to convert it to work for an ADO connection.