A quick google search on Percentile produces this formula:
Percentile = ( NumbValues Below X / Numb values ) * 100
Rearranging that produces:
NumbValues * Percentile/100 = Numb values Below X
so if you have 10 numbers and 50th percentile, you get 5. That means that if you sort your values in ascending order, the first 5 values make up the 50th percentile.
Is that what you had in mind?