How to write a formula to find nth smallest number

LibreOffice Calc
Version 4.2.6.3

Column C contains whole numbers only.
Column C may contain any number of values, i.e. there may be 40 or 599 or ??? values in that column.

I need to locate the 50 smallest numbers in that column and average them.

Thank you.

I think this formula does what you like.

=AVERAGEIF($C$1:$C$100;"<="&SMALL($C$1:$C$100;50))

Take in account that if the 50 smallest is duplicated average will include duplicates of 50 smallest.