2 Replies Latest reply: Nov 12, 2015 2:52 PM by Tomás  Fernández

# Calculating the distance between elements + Counting the # of elements within a specific range

Hello, how are you?

I have a list of shops with their corresponding latitude and longitude values (in a decimal format) and I'd like to calculate the amount of shops in the same city located within 1 kilometer for each one of them. I've managed to do this in Excel in a very homemade and manual way but I need to automate it to be able to work with bigger data.

The list contains the following fields:

Shop name     Shop ID     LATITUDE     LONGITUDE

Basically, I'd like to know for every shop what the 'shop density' around it is. Distances between the elements aren't too big, so the Pythagorean distance formula will do.

Any kind of help is appreciated.

Thank you.

• ###### Re: Calculating the distance between elements + Counting the # of elements within a specific range

Thank you very much. I modified the first one and it worked just fine. I created the following expression which displayed the "shop density" for each shop:

sum(if(Distance<[insert distance in kilometers],1,0))