+ Reply to Thread
Results 1 to 7 of 7

Sorting the Latitude and Longitude Data and Calculating Distance

  1. #1
    Registered User
    Join Date
    05-06-2024
    Location
    India
    MS-Off Ver
    2019
    Posts
    3

    Sorting the Latitude and Longitude Data and Calculating Distance

    Hello,

    This is my first post in the forum .I am looking for a stepwise approach to sort the latitude and longitude of multiple geo points and calculate the distance between the two closed points in ascending order and also calculate the total distance of the entire route in Km's. My Data is attached

    Thanks in advance
    Attached Files Attached Files
    Last edited by Rakeshv; 05-06-2024 at 11:44 AM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,328

    Re: Sorting the Latitude and Longitude Data and Calculating Distance

    I >>think<< this is what you want (complicated by the fact that you provided a very limited explanation and NO expected answers!!)

    In D3, copied down:
    =101.12 * SQRT(((B3 - B2) * COS(RADIANS(C2)))^2 + (C3 - C2)^2)
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Registered User
    Join Date
    05-06-2024
    Location
    India
    MS-Off Ver
    2019
    Posts
    3

    Re: Sorting the Latitude and Longitude Data and Calculating Distance

    Thanks Glenn for your prompt response .The formula works well but I had to sort the data by Latitude to get the correct distance between the points and the total distance . I just had another query is my approach correct or should I let the data be as it is ?

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,328

    Re: Sorting the Latitude and Longitude Data and Calculating Distance

    I cannot answer as I really don't know what you're trying to do... your explanation was minimal.

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,892

    Re: Sorting the Latitude and Longitude Data and Calculating Distance

    Is this a "shortest path" or "traveling salesman" kind of problem?

    Here's a "shortest path" problem that finds the shortest path through a series of nodes but not necessarily visiting each node: https://www.excel-easy.com/examples/...h-problem.html

    Here's a "traveling salesman" tutorial that uses Excel's Solver to find the shortest path through all nodes: http://blog.excelmasterseries.com/20...blem-with.html

    Do either of those problems look like the kind of problem you are trying to solve?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  6. #6
    Registered User
    Join Date
    05-06-2024
    Location
    India
    MS-Off Ver
    2019
    Posts
    3

    Re: Sorting the Latitude and Longitude Data and Calculating Distance

    Yes, you are right .The details provided from my end were insufficient . Actually its Travelling Salesman kind of problem where I have the Latitude and Longitude of each outlet and I have to calculate the distance between the outlet arranged in an ideal manner with shortest distance between 2 coordinates .As well as I want to know the total distance of the entire route .I am doing this exercise to optimize my salesman routes

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,892

    Re: Sorting the Latitude and Longitude Data and Calculating Distance

    If it helps, here's another tutorial for the traveling salesperson problem: https://medium.com/@rihot_gusron/sol...m-e8deea89ca42 I found several other tutorials with a search string like "traveling salesman problem Excel."

    I note that every Excel based tutorial that I am finding begins with building a distance matrix somewhere in the spreadsheet. I note that your sample file does not include a distance matrix anywhere, so it would appear that you should start there. How are you wanting to calculate distance between nodes? Can you build a matrix that calculates the distance between all nodes?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Calculating distance between two latitude longitude points
    By visha_1984 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2018, 02:04 AM
  2. Need help with my distance formula using latitude & longitude.
    By odimas in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-24-2014, 11:53 PM
  3. Distance between latitude and longitude
    By fazna ali in forum Excel General
    Replies: 2
    Last Post: 11-06-2012, 05:03 AM
  4. Distance Formula for Latitude and Longitude
    By dankappa in forum Excel General
    Replies: 4
    Last Post: 11-06-2012, 01:50 AM
  5. Replies: 0
    Last Post: 09-19-2012, 09:04 PM
  6. Latitude and Longitude: Minimize distance
    By gcool12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2010, 06:18 PM
  7. Can distance be calculated using latitude and longitude?
    By Paxton in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-02-2005, 10:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1