cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating distance between 2 different address

Highlighted
Line Chef
Line Chef

Calculating distance between 2 different address

Hello.

I'm struggling with finding the distance between 2 different addresses.  I would like to use our Technical Center (TC) office locations (we have multiple) and the customers address associated with that particular TC office. I would like to have the distance (in miles) shown the location page. It will be easier this way instead of having to google search each customer address to the TC office.  

What is the best formula to use? 

Thank you so much in advance for your help and assistance.

Melissa

0 Likes
Reply
Employee
Employee

Re: Calculating distance between 2 different address

Hi,

If you have the lat/long for these locations you can use a formula field similar to this:

DISTANCE( GEOLOCATION( IF(ISBLANK($LOCATION1LATFIELD), $LOCATION1LATFIELD, 0) , IF(ISBLANK($LOCATION1LONGFIELD), $LOCATION1LONGFIELD, 0)), GEOLOCATION( IF(ISBLANK($LOCATION2LATFIELD), $LOCATION2LATFIELD, 0) , IF(ISBLANK($LOCATION2LONGFIELD), $LOCATION2LONGFIELD, 0) ) , 'km')

Replace the italic all caps field name placeholders with a reference to your fields.

p.s. apologies for resurrecting this ancient post.