function AceUtilsMaths:Quartiles(values) -- Won't return middle quartile, since it's the same as the median and you can do :Median() for that local n = table.getn(values) table.sort(values) local lowerQPos = n * 0.25 + 0.25 local upperQPos = lowerQPos * 3 - 0.25 return (values[math.floor(lowerQPos)] + values[math.ceil(lowerQPos)]) / 2, (values[math.floor(upperQPos)] + values[math.ceil(upperQPos)]) / 2 end