Top25, Middle50, Bottom25
Posted on 1998-08-20
I am writing a program that analyses the top 25%, bottom 25%
of a range of data.
Two part question.
This is no problem but I need the average of these, not all the records.
I can do this by getting the top25/bottom25 using a query and running through recordset and then dividing by the number in each.
However I thought it may be more efficient to use a direct query, such as;
dim rs a recordset
dim rs2 a recordset
set rs=db.openrecordset("SELECT TOP 25 PERCENT FROM sometable ORDER BY somefield")
set rs2=db.openrecordset("SELECT Avg(somefield) AS avevalue
FROM " & rs2.recordset)
The rs2 causes a type mismatch error of course. Is there a way around this.
How could I calculate the average of the MIDDLE 50%