If you send me an email to:
pashurst <at> auditel.net
(change the obvious), then I can send you an Excel file which allows
you to put in two postcodes (up to the space) and then calculates the
distance between them.
Hope this helps.
Pete
On Aug 24, 7:11*pm, Matthew <harriso...@btopenworld.com> wrote:
> On 24 Aug, 18:18, Matthew <harriso...@btopenworld.com> wrote:
>
>
>
>
>
> > Help
>
> > A bit of a cheeky question.
>
> > I have found a webpage that allows a simple calculation of distance
> > between to postcodes.
>
> > its all free etc
>
> > I wondered if it is possible to send to the page from excell the 2
> > codes and return the answer ?
>
> > The bit of code on the sit is for a web page included might help.
>
> > <iframe src="http://www.PostCode.org.uk/free-postcode-distance-
> > calculator/distance-calculator.asp" scrolling="auto" frameborder="0"
> > height="220" width="375"></iframe>
>
> > Any ideas as this is wayyyyyy beyond me.
>
> > Regards
>
> > Matthew
>
> Ahha, a bit of browsing and I find an alternative way using Haversine
> Now could someone turn this into a macro please
>
> function getDistance($lat1, $long1, $lat2, $long2)
> {
> //$earth = 6371; //km change accordingly
> $earth = 3960; //miles
>
> //Point 1 cords
> $lat1 = deg2rad($lat1);
> $long1= deg2rad($long1);
>
> //Point 2 cords
> $lat2 = deg2rad($lat2);
> $long2= deg2rad($long2);
>
> //Haversine Formula
> $dlong=$long2-$long1;
> $dlat=$lat2-$lat1;
>
> $sinlat=sin($dlat/2);
> $sinlong=sin($dlong/2);
>
> $a=($sinlat*$sinlat)+cos($lat1)*cos($lat2)*($sinlong*$sinlong);
>
> $c=2*asin(min(1,sqrt($a)));
>
> $d=round($earth*$c);
>
> return $d;
>
> }
>
> Thanks
>
> Matthew- Hide quoted text -
>
> - Show quoted text -
|