View Single Post
  #4   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.newusers
Bill R[_3_] Bill R[_3_] is offline
external usenet poster
 
Posts: 25
Default Map co-ordinates conversion

Thanks,

NSEW is usually after the co-ordinates so I just swapped the RIGHT and LEFT
and it worked OK. BTW, when using NSEW the number can only go up to 90 (or
should that be 89.999...?)

That's certainly compacted an awful looking formulae.

Bill R

"macropod" wrote in message
...
Hi Bill,

Assuming your input in A3 is, say W127:30:27, you can get the decimal
representaion by:
=RIGHT(A3,LEN(A3)-1)*24*IF(LEFT(A3,1)="W",-1,1)

--
Cheers
macropod
[Microsoft MVP - Word]


"Bill R" wrote in message
...
The following converts latitude co-ordinates in cell A3 from NN:NN:NN and
N:NN:NN format to N.NN format. (A similar formulae does the same for
longitude co-ordinates.)

=IF(RIGHT(A3,1)="W",IF(MID(A3,2,1)=":",(LEFT(A3,1) )+(MID(A3,3,2)/60)+(MID(A3,6,2)/60/60),(LEFT(A3,2))+(MID(A3,4,2)/60)+(MID(A3,7,2)/60/60))*-1,IF(MID(A3,2,1)=":",(LEFT(A3,1))+(MID(A3,3,2)/60)+(MID(A3,6,2)/60/60),(LEFT(A3,2))+(MID(A3,4,2)/60)+(MID(A3,7,2)/60/60)))

It is complicated as it needs to accommodate source information in
degrees in NN and N format (others are given in NN format) and, of
course, the output to be both positive (east of Greenwich and north of
the equator) and negative. Is there a better (shorter) formulae that
will do the same job?

Thanks.

Bill R