Distance() Function in Salesforce | Syntax, Examples, & Use Cases

We are using Salesforce CRM to manage customer visits for our sales team. Each customer’s address is stored with Latitude and Longitude fields in Salesforce.

As a Salesforce Admin, I created a Formula Field that uses the DISTANCE() function to calculate the distance between the customer’s location and the Sales Office location. The result is shown in kilometres.

This helps the sales team quickly check the travel distance before planning customer visits and optimising their schedules.

In this article, we will learn about the Distance() function in Salesforce and how to use this function to calculate the distance between two numerical values or points. Additionally, we will focus on its syntax and provide some practical examples.

This Tutorial Covers: