Try
=COUNTIF(range;"\b"&Xn&"\b")
- where "range" represents the column of data and Xn represents the cell containing the code to be counted. Remember that you need to have Tools | Options... | LibreOffice Calc | Calculate | Enable regular expressions in formulae ticked (which is the case by default).
I trust this helps.
Brian Barker