Latitude/ Longitude Formatting

reganshaw

Board Regular
Joined
May 6, 2005
Messages
77
Hi All - It's been a while - hope one of you can help.

I have latitude & longitude information in a text string that I am trying to convert to decimal format.

In cell A1 the Latitude value is 0434010N
In cell B1 the Longitude value is 0792201W

In both of the above;
Characters 1 - 3 represent Degrees
Characters 4 - 5 represent Minutes
Characters 6 - 7 represent Seconds
Character 8 is "N" for Latitude and "W" for Longitude

In cell C1 I want the Latitude to display as 43.669364, and in D1 the Longitude to display as -79.367098

Any suggestions?

Thanks in advance.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
a​
b​
c​
1​
0434010n
43.669444​
b1: =sumproduct(--mid(a1, {1,4,6}, {3,2,2}) * {3600,60,1}/3600) * if(or(right(a1) = {"w","s"}), -1, 1)
2​
0792201w
-79.366944​
 
Upvote 0
Thank you both! Both are perfect and do exactly what I need!
SHG, if it isn't too much to ask, can you explain what is happening between the { }'s in your solution? I've not seen this before.
 
Upvote 0

Forum statistics

Threads
1,215,360
Messages
6,124,493
Members
449,166
Latest member
hokjock

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top