I'm trying to calculate the initial bearing (forward azimuth) between two positions using latitude and longitude. After much googling most of what I can find either relates to calculating distance, or calculates using an equirectangular projection.
The closest I could find is the formula:
θ = atan2( sin Δλ ⋅ cos φ2 , cos φ1 ⋅ sin φ2 − sin φ1 ⋅ cos φ2 ⋅ cos Δλ )
which when using excel needs to be reversed:
=ATAN2(COS(lat1)*SIN(lat2)-SIN(lat1)*COS(lat2)*COS(lon2-lon1),SIN(lon2-lon1)*COS(lat2))
The output should give me the answer in radians, which I convert to degrees using:
=MOD(DEGREES(answer)+360,360)
However I'm not getting anything that makes sense.
My test points are located in the southern hemisphere: -17.9467 122.2350 and -20.3783 118.6233
I should be getting an answer of about 232 degrees (there's 1-2 degrees of magnetic variation in this answer whereas the formula is in degrees True), however I'm getting 177 degrees.
Can anyone see my (probably simple) error?