Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Squid
 
Posts: n/a
Default Distance between zip codes

I need help constructing a formula to determine the distance between 2 zip
codes (actually the demical Lat & Lon). The zip code information was
downloaded from http://data.geocomm.com/editorspicks...ensuszips.html

I found the formula on this site: http://www.dbazine.com/weeg9.shtml

Column D: Decimal Longitude
Column E: Decmimal Latitude
Column F: DLON
Column G: DLAT
Column H: A
Column I: C
Column J: D


My excel equivlent formulas a
DLON = =ABS(D3-D2)
DLAT = =ABS(E3-E2)
A = SIN(G2/2)^2+COS(E2)*COS(E3)*SIN(F2/2)^2
C = 2*ASIN(MIN(1,SQRT(H2)))
D = 0.017453293*I2

But result is not correct. Anybody know what I did wrong?

TIA
Mike



  #2   Report Post  
Squid
 
Posts: n/a
Default

http://www.cpearson.com/excel/latlong.htm

Forgot about the greatest excel help site on the web. Thanks Chip!

"Squid" wrote:

I need help constructing a formula to determine the distance between 2 zip
codes (actually the demical Lat & Lon). The zip code information was
downloaded from http://data.geocomm.com/editorspicks...ensuszips.html

I found the formula on this site: http://www.dbazine.com/weeg9.shtml

Column D: Decimal Longitude
Column E: Decmimal Latitude
Column F: DLON
Column G: DLAT
Column H: A
Column I: C
Column J: D


My excel equivlent formulas a
DLON = =ABS(D3-D2)
DLAT = =ABS(E3-E2)
A = SIN(G2/2)^2+COS(E2)*COS(E3)*SIN(F2/2)^2
C = 2*ASIN(MIN(1,SQRT(H2)))
D = 0.017453293*I2

But result is not correct. Anybody know what I did wrong?

TIA
Mike



  #3   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Wed, 9 Mar 2005 16:57:08 -0800, "Squid"
wrote:

I need help constructing a formula to determine the distance between 2 zip
codes (actually the demical Lat & Lon). The zip code information was
downloaded from http://data.geocomm.com/editorspicks...ensuszips.html

I found the formula on this site: http://www.dbazine.com/weeg9.shtml

Column D: Decimal Longitude
Column E: Decmimal Latitude
Column F: DLON
Column G: DLAT
Column H: A
Column I: C
Column J: D


My excel equivlent formulas a
DLON = =ABS(D3-D2)
DLAT = =ABS(E3-E2)
A = SIN(G2/2)^2+COS(E2)*COS(E3)*SIN(F2/2)^2
C = 2*ASIN(MIN(1,SQRT(H2)))
D = 0.017453293*I2

But result is not correct. Anybody know what I did wrong?

TIA
Mike



Mike,

Excel's trig functions expect the angles to be in radians; you are inputting
them in degrees and not converting.

So for each reference to a lat/long, encase it in a RADIANS argument.

e.g. DLON = ABS(RADIANS(D3) - RADIANS (D2))



--ron
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
Excel doesn't sort zip codes properly [email protected] Excel Discussion (Misc queries) 4 February 4th 05 12:30 AM
Printing zip codes that start with 0 ET13 Excel Discussion (Misc queries) 0 January 16th 05 11:47 PM
Set column to only allow certain codes??? Buttercup Excel Worksheet Functions 1 January 6th 05 08:29 PM
I am not able to format cells for zip codes JMelloman Excel Worksheet Functions 3 December 14th 04 02:24 AM
Time and distance formula drumnotme118 Excel Worksheet Functions 2 November 20th 04 06:22 AM


All times are GMT +1. The time now is 06:02 AM.

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

About Us

"It's about Microsoft Excel"