How do you determine weight of a yarn?

I have a yarn that seems to be finer than my worsted but I can’t figure it out. Online I have seen that it is 4-5 stitches and inch and it is 106 yards for 40 grams. Is there a formula for this sort of thing? It is a wool/alpaca and very yummy so I am trying to find the best pattern for it.

Being 4-5 sts per inch is probably worsted, depends on the needle size and exactly how many sts over 4" - there’s a big difference between 16 and 20 sts in 4". One of the quickest ways to determine the yarn weight is wraps per inch, or wpi. Here’s a couple charts for wpi - and

Yep wraps per inch, or look for it on yarndex. Metreage per weight depends on fibre content.