Caculate lat/lon from distance

Given a start point, a distance and a heading, it is possible to work out the resulting latitude and longitude. See the maths behind it here.   See Radians Versus Degrees for the utility functions we are going to use in this calculation. There's an example of a mashup using this at Urbarama mashup

Variables

The variables required to calculate a new lat/lon are
1. Origin Latitude and Longitude
2. Heading in degrees from origin
3. Distance in kilometers from origin

Together, they can be used to create the latitude and longitude of a new point like this

Code

You will find this code in the google apps script mcpher library or in the downloadable cDataSet.xlsm (usefulStuff module), at this gist, and below

Excel formula version

You may of course want to do all this in an Excel formula. Here's some data, in this case on Row 5.

new Latitude formula (cell e5)
`=ASIN(SIN(A5*PI()/180)*COS(D5/6371)+COS(A5*PI()/180)*SIN(D5/6371)*COS(C5))*180/PI()`

new Longitude formula (cell f5)
`=((B5*PI()/180)+ATAN2(COS(D5/6371)- SIN(A5*PI()/180)*SIN(ASIN(SIN(A5*PI()/180)*COS(D5/6371)+COS(A5*PI()/180)*SIN(D5/6371) *COS(C5))),SIN(C5)*SIN(D5/6371)*COS(A5*PI()/180)))*180/PI()`

new latitude formula calling VBA function (cell g5)
`=getLatFromDistance(A5,D5,C5)`

new longitude formula calling VBA function (cell h5)
`=getLonFromDistance(A5,B5,D5,C5)`