There is no golden rule to purchasing the correct size ski. The length of a ski has a lot of variable factors including; height, weight, skier ability, ski type, what terrain you intend on skiing, camber/rocker ratio and personal preference.
A good starting point is that a beginner skier usually uses a ski from shoulder to chin height, an intermediate generally uses from chin to eyebrow and an advanced skier is usually anywhere from nose up to wherever the skier feels comfortable.
It's also worth noting that every ski brand measures their ski length differently. SO even if the ski states it's a 170cm it may be slightly shorter or longer than it's description.
This is where variable factors come into play. There are multiple reasons why some people choose shorter or longer, narrow or wider skis. As a general rule a shorter narrower ski will be easier to turn because it will have a naturally shorter turn radius - this is compared to a longer ski which will be more stable at higher speeds and wider skis which will provide floatation and control in deeper snow or variable terrain.