(Solved) – How do I calculate a route between two cells, distinguishing between “land” and “water” cells?


World Map

I am using Excel and VBA for D&D and have made a world map seperating resources between different cells. I am using this to calculate the distance between the towns and the resources, so that I can calculate the price per pound of the resource.

In order to find the distance between two points (the resource and the town) I use this formula:

=SQRT(([@ROW]-$C$2)^2 ([@COLUMN]-$D$2)^2)

This finds the hypotenuse between the two points, using the columns and rows difference as the other sides of the triangle.

However, I need to go one step further and have a means to tell whether the hypotenuse travels through water tiles or land.

Leave a Reply

Your email address will not be published. Required fields are marked *