maybe you were making a scarf by a pattern that the clerk knew? If you change the yarn in a pattern, for example, you can often calculate how much you need by the legth per 50 g and the stitch count.
I do not know any yarn formular, either.
If I really wanted to know ahead of time and had no pattern to start from, I might find 2 ways to get close to an answer: look - for example on ravelry - for scarfs of the same yarn and the size they got with a certain amount. Every knitter IS different, but it will give you an idea.
the other thing: with a scarf you know how many stitches you have across and how many rows per 4 inch, once you made a swatch. Now I would knit a swatch 4 inches long in the size of the scarf (or just knit the scarf for that long, really). Now I figure out the WEIGHT of yarn I used by now.
the knitting has the needles in. Either weigh a needle beforehand and deduct the weight or weigh the skein before and after to find out the difference. Now that is your usage for 4 inches of scarf.
Now you know how many inches you want it to be and multiply accordingly.
Warning: the lighter the yarn is the less acurate your calculation may be because small differences make a big change on the calculations.
But if you know the width and length you really need, then just reserve yarn at the yarn shop, or buy extra for safety, or buy stuff you can bring back (like at my yarn shop: they take back unused balls)