Search code examples
vbams-accessquartile

Access 25%, 50%, 75% Quartiles (Data From Query and Result Destination is a Report)


The data that I need the quartiles is a query with the first column being the month-year and the second column being a count of defects for that month. I am looking to have the quartiles to be displayed on a report (Name: QE Quartile Test).

Query name: QE Test Count Step 2 Columns names: ProductionYM ; Claims

The following code is something I found online but I don't code much so I don't know where to go from here.

Public Function XPercentile()
    XPercentile = DMin(Claims, QETest, "DCount(""*"", """ & QETest & """, """ & Claims & "<="" & [" & Claims & " ]) >= " & 0.5 * DCount("*", QETest))
End Function

I am aware that excel has all the functions to do this but I was requested to get this to work in access.


Solution

  • You can find that here on GitHub: VBA.Quartiles

    Calculate quartiles in 20 ways and medians in Microsoft Access

    Code is way to much to post here, but included is also a link to the full documentation:

    20 Varieties of Quartiles

    (if you don't have an account, browse for the link: Read the full article)