I'm attempting to find the Percentile of a column of numbers when a certain
condition is met based on another column. For some reason or other with the
Percentile I cannot get this to work. I use it all the time with many other
functions. What is it about the Percentile that produces the errors?

Here is my formula:

=IF($K$22:$K$4880=2,PERCENTILE($I$22:$I$4880,$A3))

The values in column K must be equal to two in order for the percentile
function to be applied to the values in column I. Where am I going wrong
here? Any help would be appreciated.