PatPhelan

Convert Longitude/Latitude formats

Discussion created by PatPhelan on Jan 29, 2017
Latest reply on Jan 29, 2017 by jbrown

I have a series of coordinates in degree/decimal minute format (30,19.32141120N, 86,8.21221140W) that I am trying to convert into Decimal format. I have put together the following to convert the latitude

 

Left ( Latitude ; 2 )+(Middle ( Latitude ; 4 ; 8 ))/60

 

and it appears to work without a problem.

 

My problem arises with the longitude. In the example above, there are only two digits (86) to left of the comma; however, if you go far enough west, that becomes three digits.  So my formula:

 

Left ( Longitude;  2 )+(Middle ( Longitude ; 4 ;8 ))/60

 

only works on the two-digit format.

 

I don't know enough about programming to do an if, this, then, that-type thing. My inelegant solution is to simply perform the calculation again, starting with the fifth character.

 

Is it possible to do what I want? Could someone point me in the right direction?

 

Again, many thanks. I always appreciate the help given.

Outcomes