Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-30-2015, 09:59 AM
Steve81uk Steve81uk is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2013
Novice
trying to find a way to show a closest to using lat and long coordinates
 
Join Date: Jan 2015
Posts: 16
Steve81uk is on a distinguished road
Default trying to find a way to show a closest to using lat and long coordinates

Back again,

Tried a few ways at doing this but need help, using Lat and Long coordinates I would like to find the closest (lets just call for example) "well"

I have attached a sheet, the first tab needs to show the closest beside each location.



This shows two separate columns, one Lat and the other Long, then using the "well" tab, I would like to find the closest one to each Location.

Am sure there must be a way, I just cant get my head around it, have tried doing matches, Chooses, Lookup functions but not having much luck.


Any help would be greatly appreciated.

Thanks very much

Steve
Attached Files
File Type: xlsx Help.xlsx (20.6 KB, 94 views)
Reply With Quote
  #2  
Old 02-02-2015, 08:05 AM
gebobs gebobs is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2010 64bit
Expert
 
Join Date: Mar 2014
Location: Atlanta
Posts: 837
gebobs has a spectacular aura aboutgebobs has a spectacular aura about
Default

Let me get this straight...for each set of coordinates on the first tab, you would like to look up the well on the second tab that is closest?
Reply With Quote
  #3  
Old 02-02-2015, 08:10 AM
Steve81uk Steve81uk is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2013
Novice
trying to find a way to show a closest to using lat and long coordinates
 
Join Date: Jan 2015
Posts: 16
Steve81uk is on a distinguished road
Default

That is the what I am hoping to achieve, I feel this is impossible so am just having to do this manually on maps. Very time consuming.
Reply With Quote
  #4  
Old 02-02-2015, 08:26 AM
gebobs gebobs is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2010 64bit
Expert
 
Join Date: Mar 2014
Location: Atlanta
Posts: 837
gebobs has a spectacular aura aboutgebobs has a spectacular aura about
Default

Hoo boy...I bet this can be done with code. Perhaps try the Excel programming forum just below this. My coding abilities are rusty as hell, but I bet there's someone there that can steer you right.
Reply With Quote
  #5  
Old 02-02-2015, 08:32 AM
Steve81uk Steve81uk is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2013
Novice
trying to find a way to show a closest to using lat and long coordinates
 
Join Date: Jan 2015
Posts: 16
Steve81uk is on a distinguished road
Default

So definitely no formulae / calculation. My coding abilities are close to non existent, so I think will just settle with having to use a map app to manually do it. just wanted to make my job at work easier.

I'll try the programming forum they may have some ideas.

Thank you for getting back to me.
Reply With Quote
  #6  
Old 02-02-2015, 08:46 AM
gebobs gebobs is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2010 64bit
Expert
 
Join Date: Mar 2014
Location: Atlanta
Posts: 837
gebobs has a spectacular aura aboutgebobs has a spectacular aura about
Default

Quote:
Originally Posted by Steve81uk View Post
So definitely no formulae / calculation. My coding abilities are close to non existent, so I think will just settle with having to use a map app to manually do it. just wanted to make my job at work easier.

I'll try the programming forum they may have some ideas.

Thank you for getting back to me.
I don't know. It might be possible with some array functions, but that is again above my pay grade.

I googled "lookup comparing coordinates excel" and there were a lot of articles, some going back as far as 2002. There were a few promising solutions, but they all required code e.g. http://www.excelbanter.com/showthread.php?t=121991
Reply With Quote
  #7  
Old 02-02-2015, 09:08 AM
Steve81uk Steve81uk is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2013
Novice
trying to find a way to show a closest to using lat and long coordinates
 
Join Date: Jan 2015
Posts: 16
Steve81uk is on a distinguished road
Default

Thanks very much anyway,
Reply With Quote
  #8  
Old 02-02-2015, 06:57 PM
macropod's Avatar
macropod macropod is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try the following array formula:
Code:
=INDEX(Well!C:C,MATCH(MIN(ACOS(SIN(RADIANS(B7))*SIN(RADIANS(Well!A$2:Well!A$151))+COS(RADIANS(B7))*COS(RADIANS(Well!A$2:Well!A$151))*COS(RADIANS(C7-Well!B$2:Well!B$151)))),ACOS(SIN(RADIANS(B7))*SIN(RADIANS(Well!A$2:Well!A$151))+COS(RADIANS(B7))*COS(RADIANS(Well!A$2:Well!A$151))*COS(RADIANS(C7-Well!B$2:Well!B$151))),0)+1,0)
Note: You'll need to delete any spaces inserted into the formula by the forum software.

The approximate minimum distance (in km) is given by the array formula:
Code:
=MIN(ACOS(SIN(RADIANS(B7))*SIN(RADIANS(Well!A$2:Well!A$151))+COS(RADIANS(B7))*COS(RADIANS(Well!A$2:Well!A$151))*COS(RADIANS(C7-Well!B$2:Well!B$151))))*6367.465
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 02-02-2015, 08:22 PM
gebobs gebobs is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2010 64bit
Expert
 
Join Date: Mar 2014
Location: Atlanta
Posts: 837
gebobs has a spectacular aura aboutgebobs has a spectacular aura about
Default

Bravo, Paul. Bravo!!!!
Reply With Quote
  #10  
Old 02-03-2015, 01:42 AM
Steve81uk Steve81uk is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2013
Novice
trying to find a way to show a closest to using lat and long coordinates
 
Join Date: Jan 2015
Posts: 16
Steve81uk is on a distinguished road
Default

Wow! Thanks very much, I don't understand a single part of it, but it works!

Thanks again.

Steve
Reply With Quote
  #11  
Old 02-03-2015, 03:24 AM
macropod's Avatar
macropod macropod is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

FWIW, the standard formula for calculating the distance between two lat/lon coordinates is:
Code:
ACOS(SIN(RADIANS(Lat1))*SIN(RADIANS(Lat2))+COS(RADIANS(Lat1))*COS(RADIANS(Lat2))*COS(RADIANS(Long1-Long2)))*RadiusEarth
That's the basic formula my solution uses. It's not especially accurate at very small differences, particularly near the poles, but that's of no consequence for this exercise, and any errors will still scale according to the differences in the true distances. Without the '*RadiusEarth' part (6367.465km on average), you simply get a value applicable to any size sphere. Indeed, the above formula all there is to the second one in post #8, except that one also uses the MIN function in an array formula to return the minimum distance.

The MATCH function simply uses two of these formulae (without the '*RadiusEarth' part), first with the MIN function to calculate a minimum spherical value, the second without the MIN function to find which row produces that value. The INDEX function merely outputs the corresponding name from the row returned by the MATCH function in column C.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #12  
Old 05-20-2015, 06:32 AM
bmacdonald bmacdonald is offline trying to find a way to show a closest to using lat and long coordinates Mac OS X trying to find a way to show a closest to using lat and long coordinates Office for Mac 2011
Novice
 
Join Date: May 2015
Posts: 1
bmacdonald is on a distinguished road
Default Final Excel

Hello,

Can you post the final Excel file with the working functions? I'm having trouble replicating in my file.

Thanks,
Brian
Reply With Quote
  #13  
Old 05-22-2015, 01:42 AM
Steve81uk Steve81uk is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2013
Novice
trying to find a way to show a closest to using lat and long coordinates
 
Join Date: Jan 2015
Posts: 16
Steve81uk is on a distinguished road
Default

Hi Brian.

Am trying to look for it, but I either did a copy and paste special on the final sheet, or found that in the end might have just used Google Earth. It was a while ago now and i cannot remember for the life of me.

Sorry


If I do find I will post up on here for you..


Steve
Reply With Quote
  #14  
Old 06-05-2015, 01:04 AM
macropod's Avatar
macropod macropod is offline trying to find a way to show a closest to using lat and long coordinates Windows 7 64bit trying to find a way to show a closest to using lat and long coordinates Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

See attached.
Attached Files
File Type: xlsx Demo.xlsx (32.8 KB, 234 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #15  
Old 04-24-2018, 03:32 AM
Leaffy Leaffy is offline trying to find a way to show a closest to using lat and long coordinates Windows 10 trying to find a way to show a closest to using lat and long coordinates Office 2010 64bit
Novice
 
Join Date: Apr 2018
Posts: 2
Leaffy is on a distinguished road
Default

Sorry to bump a 3 year old thread, however this gives me exactly what I need however when I try to expand the number of "Wells" being matched from 151 to 766 I return #N/A values. How would edit this code to look up against all 766 wells?

Code:
=INDEX(Well!C:C,MATCH(MIN(ACOS(SIN(RADIANS(B7))*SIN(RADIANS(Well!A$2:Well!A$151))+COS(RADIANS(B7))*COS(RADIANS(Well!A$2:Well!A$151))*COS(RADIANS(C7-Well!B$2:Well!B$151)))),ACOS(SIN(RADIANS(B7))*SIN(RADIANS(Well!A$2:Well!A$151))+COS(RADIANS(B7))*COS(RADIANS(Well!A$2:Well!A$151))*COS(RADIANS(C7-Well!B$2:Well!B$151))),0)+1,0)
All help is greatly appreciated

Regards
Reply With Quote
Reply

Tags
find the closest, lat and long

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show two alternating slides as long as music plays Magic PowerPoint 2 11-23-2014 09:02 AM
trying to find a way to show a closest to using lat and long coordinates Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM
trying to find a way to show a closest to using lat and long coordinates Highlight and put bookmark on the closest field to the cursor b0x4it Word VBA 11 05-19-2011 11:15 PM
Question: Hyperlink to other show, but close the current show habibfikri PowerPoint 0 12-26-2010 02:37 AM
PP 2010 .avi file plays during slide show, but causes the slide show to loop to begin VictorS PowerPoint 0 10-16-2010 10:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:38 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft