Hi All,
I am trying to make a spreadsheet for planning my next hike. In this spreadsheet I want to enter X and Y coordinates and elevation of point A, B, C, etc, than from that I want the spreadsheet to calculate the distance between point A and B, elevatain gain or loss and the time it will take to hike from A to B. So far so good, but I also want the spreadsheet to calculate the compass bearing and it seems I get stuck on some logic functions. Look at te picture below.

Points A to D have the following coordinates:

Now I can calculte the angle between North and the heading from A to B with the 3rd formula. The compass bearing than is 360-'theta'AB.
I can also calculate the angle between North and the heading from B to C, with the same 3rd formula. The compass bearing now is the same as the angle.
Continueing, the bearing from C to D will be 180-'theta'CD and the bearing from D to A will be 180+'theta'DA.

