Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Distance between latitude and longitude

I want to calculate distance between two latitude and longitude coordinate.

The macro turn to have
compile error:
Argument not optional

i think it because of the

Cells(i, 5) = GreatCircleDistance(Lat1, long1, Lat2, long2)

does not declare all argument from the GreatCicrcleDistance function. but when i put all the arguments to the equation, nothing is happen.

Actually how to apply the function so it can be use in the excel sheet.?

Btw, i've attached the xsl file together in this thread.
Please take a look on it.
Thank you very much.
Attached Files
File Type: zip DistanceLatLon.zip (15.1 KB, 70 views)
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,045
Default Distance between latitude and longitude

On Wed, 7 Nov 2012 02:42:03 +0000, Fazna Ali wrote:


I want to calculate distance between two latitude and longitude
coordinate.

The macro turn to have
compile error:
Argument not optional

i think it because of the

Cells(i, 5) = GreatCircleDistance(Lat1, long1, Lat2, long2)

does not declare all argument from the GreatCicrcleDistance function.
but when i put all the arguments to the equation, nothing is happen.

Actually how to apply the function so it can be use in the excel
sheet.?

Btw, i've attached the xsl file together in this thread.
Please take a look on it.
Thank you very much.


+-------------------------------------------------------------------+
|Filename: DistanceLatLon.zip |
|Download: http://www.excelbanter.com/attachment.php?attachmentid=669|
+-------------------------------------------------------------------+


Your macro doesn't even get that far.

Function GreatCircleDistance(Latitude1 As Double, Longitude1 As Double, _
Latitude2 As Double, Longitude2 As Double, _
ValuesAsDecimalDegrees As Boolean, _
ResultAsMiles As Boolean) As Double

On your worksheet, your latitude and longitude are both text strings, not doubles; and you didn't bother to enter anything for the non-optional arguments: ValuesAsDecimalDegrees or ResultAsMiles.
Any or all of that will result in a #VALUE! error.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting Latitude/Longitude Mike and Cheryl Tindall Excel Discussion (Misc queries) 1 October 15th 09 12:39 AM
Distance calculator from longitude and latitude abusaeed Excel Discussion (Misc queries) 2 June 12th 08 01:26 AM
Determining Distance from Latitude and Longitude morchard Excel Discussion (Misc queries) 3 January 25th 06 12:40 AM
Can distance be calculated using latitude and longitude? Paxton Excel Worksheet Functions 1 May 2nd 05 02:34 PM
Help with Latitude and Longitude. LadiFireBug New Users to Excel 1 January 22nd 05 08:54 AM


All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"