I am trying to calculate 99.5% percentile for a dataset of 100,000 values in an array (arr1) in VBA using the percentile function as follows:
Pctile = Application.WorksheetFunction.Percentile(arr1, 0.995)
Pctile = Application.WorksheetFunction.Percentile_Inc(arr1, 0.995)
Nothing works, and I keep getting type mismatch (13).
The code works fine if I limit the size of the array to a maximum of 65536. As far as I know, the calculation is limited by available memory since Excel 2007, the size of the array when switching to a macro limited by available memory with Excel 2000.
I am using Excel 2010 on a high performance server. Can anyone confirm this problem? Assuming this, I believe that my parameters are to build the vba function to calculate the percentile "manually" or output to the worksheet, count it and read it. Are there any alternatives and what will be faster?
source
share