When I was about 10 and at school I had a handcraft book that explained in a very simple way how to calculate the number of sctiches you need. I looked at it so often that I still remember the page exactly! Eventually I learned it by heart.
(= Width of finished knitting multiplied with the number of stiches in the sample, then divided by the width of the sample)
This works just as well if you use centimeters or other units of measurement.
I normally have about 30 stiches in the sample, or more if there is a wide patterning on it like cables or lace. The sample obviously needs to be knitted in the same wool and using the same needles you plan to use for the actual work. When measuring it I leave out 2-3 stiches from each edge and of course count them out from the number of stiches in the sample.