Split latitude and longitude AND limit to 6 decimal places

PatRichard

New Member
Joined
Dec 29, 2018
Messages
29
Office Version
  1. 365
Platform
  1. Windows
I need to take a returned latitude and longitude value and split it into two cells. And for each, I need to limit the values to 6 digit places.

For example, I get back a value of "42.3006892,-83146552" and put it into Q6. I need it to have one cell (latitude) with 42.300689 and one (longitude) with -83.314655.

For the latitude, I can use
Excel Formula:
LEFT(Q6, FIND(",", Q6) - 2)
and get what I need. For the longitude, the closest I've figured out is
Excel Formula:
RIGHT(Q6, LEN(Q6) - FIND(",", Q6))
. I just haven't figured out the best way of getting the longitude to six decimal places. My bigger question is whether I'm headed in the right direction, or if there is a more elegant approach? Longitude can be >= 100, so I can't simply just use LEFT().

Thoughts?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Try:
Book1
ABC
142.3006892,-8314655242.300689-83146552.000000
Sheet2
Cell Formulas
RangeFormula
B1:C1B1=--TEXTSPLIT(A1,",")
Dynamic array formulas.


You can adjust the decimal places on the Home tab.
Screen Shot 2024-07-26 at 7.16.05 AM.png
 
Upvote 0
Hi,

maybe you can use :

Book1
CDEFGHI
1
242.3006892,-83.14655242.300689
3-83.14
4
Sheet1
Cell Formulas
RangeFormula
H2H2=LEFT(D2, FIND(",", D2) - 2)
H3H3=ROUNDDOWN(VALUE(RIGHT(D2, LEN(D2) - FIND(",", D2))),2)


sorry, the 2 at the end reounds down to 2 figures - change to 6
 
Upvote 0
Maybe this?:

(I'm assuming that the data in cell Q6 actually should be "42.3006892,-83.146552", with the second period).

Book1
QRS
642.3006892,-83.14655242.300689-83.146552
Sheet3
Cell Formulas
RangeFormula
R6:S6R6=ROUND(TEXTSPLIT(Q6, ","),6)
Dynamic array formulas.
 
Upvote 0
Try:
Book1
ABC
142.3006892,-8314655242.300689-83146552.000000
Sheet2
Cell Formulas
RangeFormula
B1:C1B1=--TEXTSPLIT(A1,",")
Dynamic array formulas.


You can adjust the decimal places on the Home tab.
View attachment 114551

So I'm using a VBA method (method #2 from How to Use Geocoding in Excel? - 2 Examples - ExcelDemy) for the geocoding, and the buttons above seem to have no effect. I tried formatting the cells as well. No joy.

Hi,

maybe you can use :

Book1
CDEFGHI
1
242.3006892,-83.14655242.300689
3-83.14
4
Sheet1
Cell Formulas
RangeFormula
H2H2=LEFT(D2, FIND(",", D2) - 2)
H3H3=ROUNDDOWN(VALUE(RIGHT(D2, LEN(D2) - FIND(",", D2))),2)


sorry, the 2 at the end reounds down to 2 figures - change to 6
Yes - this seems to work. I had looked at round(), but anything I tried resulted in the last number being changed, which results in an incorrect coordinate. This data is being fed into a phone system for 911 calls, so it's important that it be as close as possible.

Thanks!
 
Upvote 0
and the buttons above seem to have no effect. I tried formatting the cells as well. No joy.
I'm not familiar with the gecoding, but try select the cells -> Ctrl + 1 -> Numbers -> Decimal places =6.
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,636
Members
452,662
Latest member
Aman1997

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