Math - distance to percentage

Im trying to convert the percentage of a level and its completion based on distance to the end object So in each level there is a spawn point and an end point, ive got the distance between the player and the end point but Im struggling to work out a percentage?

Logically Im guessing itd be to get the distance between spawn and end as well as player and end then im stuck, would it be something like distance between spawn and end multiplied by 100 divided by distance berween player and end point then round it to the nearest int?

Any help appreciated, thanks

well, you can have the distance from the spawn point and the object, then the distance from the spawn to the end lets call distancespawnobject and distancespawnend divide distancespawnobject / distancespawnend and the result multiplied by 100 or the 10 factor to make the result a number between 0-100

If you don't want the complexity of paths, and you don't want the distance to go over 100% then use (100 * spawnToPlayer)/(spawnToPlayer + playerToEnd).