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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
[table="width:, class:grid"][tr][td="bgcolor:#c0c0c0"][/td][td="bgcolor:#c0c0c0"]
a​
[/td][td="bgcolor:#c0c0c0"]
b​
[/td][td="bgcolor:#c0c0c0"]
c​
[/td][/tr][tr][td="bgcolor:#c0c0c0"]
1​
[/td][td]0434010n[/td][td="bgcolor:#ccffcc"]
43.669444​
[/td][td="bgcolor:#ccffcc"]b1: =sumproduct(--mid(a1, {1,4,6}, {3,2,2}) * {3600,60,1}/3600) * if(or(right(a1) = {"w","s"}), -1, 1)[/td][/tr]
[tr][td="bgcolor:#c0c0c0"]
2​
[/td][td]0792201w[/td][td="bgcolor:#ccffcc"]
-79.366944​
[/td][td][/td][/tr]
[/table]
 
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,224,816
Messages
6,181,143
Members
453,021
Latest member
Justyna P

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