+ Reply to Thread
Results 1 to 7 of 7

Calculating the distance between coordinates with conditions

  1. #1
    Registered User
    Join Date
    04-21-2017
    Location
    canada
    MS-Off Ver
    2007
    Posts
    4

    Exclamation Calculating the distance between coordinates with conditions

    Hi Guys,

    i've hit a problem with my set of data. I've a set of GPS coordinates in Decimal Degree format. the goal is to calculate the distance between coordinates from point to multipoint.

    formula to calculate distance between two coordinates:

    =ROUND(6371*ACOS(COS(RADIANS(90-I19))*COS(RADIANS(90-I20))+SIN(RADIANS(90-I19))*SIN(RADIANS(90-I20))*COS(RADIANS(J19-J20)))/1.609,2)
    Last edited by chucky11; 04-21-2017 at 10:39 PM.

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Calculating the distance between coordinates with conditions

    is it possible for you to attach a workbook with more data in it (like 50 site ID)?
    With this, it'll help us to come up with a solution more easily.
    Make sure, some of them are close enough to trigger the highlighting or flagging.
    Thanks
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    04-21-2017
    Location
    canada
    MS-Off Ver
    2007
    Posts
    4

    Re: Calculating the distance between coordinates with conditions

    Hi Pierre,

    Thank you for answering my post.
    I've attached a sample document, of course my original document has a lot more tabs than this but the information in this document is what is needed for the script.

    FYI these are not actual radio sites, just a bunch of random coords that are near each other, they are close enough to cause alarms on some points.
    Last edited by chucky11; 04-21-2017 at 10:40 PM.

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Calculating the distance between coordinates with conditions

    Here is a macro that will write in column G all the conflicting sites.
    Please Login or Register  to view this content.
    See attached workbook for a working example.
    I'm using Sheet2 as a calculating facility. There are named ranges in there. make sure you don't erase them.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-21-2017
    Location
    canada
    MS-Off Ver
    2007
    Posts
    4

    Re: Calculating the distance between coordinates with conditions

    awesome, your marco works great!

    quick question, would i have to change if the data were to be in a different cell?

    merci pierre

  6. #6
    Registered User
    Join Date
    04-21-2017
    Location
    canada
    MS-Off Ver
    2007
    Posts
    4

    Re: Calculating the distance between coordinates with conditions

    Quote Originally Posted by p24leclerc View Post
    Here is a macro that will write in column G all the conflicting sites.
    Please Login or Register  to view this content.
    See attached workbook for a working example.
    I'm using Sheet2 as a calculating facility. There are named ranges in there. make sure you don't erase them.
    as i was testing out the functionality of the script i found that the distance the macro is outputing is wrong by about 4 miles

    for exmple: 32.248723 -93.2114922038100-6.94 / 2038100-6.94

    32.219155 -93.19921 2038100-6.94 /

    but the actual distance is 2.17 miles approximately not 6.94 as reported

    could it be that the script is calculating to fast and the captured mile is a distance from another locations?
    Last edited by chucky11; 04-21-2017 at 11:27 PM.

  7. #7
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Calculating the distance between coordinates with conditions

    sorry, here is the modified macro.
    I was converting the degrees into radian but your formula already takes care of this.
    Please Login or Register  to view this content.

+ 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. How to calculate distance between coordinates
    By madelingirly in forum Excel General
    Replies: 4
    Last Post: 10-01-2015, 02:00 PM
  2. [SOLVED] geo-coordinates distance issue
    By dmitrij in forum Excel General
    Replies: 1
    Last Post: 02-20-2014, 09:58 AM
  3. Distance between Coordinates
    By dustinh48625 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-11-2013, 09:17 PM
  4. Replies: 0
    Last Post: 09-19-2012, 09:04 PM
  5. Coordinates and Distance formula
    By cporter5 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2010, 06:41 PM
  6. [SOLVED] Distance between two sets of coordinates... update
    By Marcus Fox in forum Excel General
    Replies: 4
    Last Post: 03-23-2006, 03:10 PM
  7. Distance between two sets of coordinates.
    By Marcus Fox in forum Excel General
    Replies: 2
    Last Post: 03-20-2006, 12:40 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