Formatting Dotted Decimal Values

sahaider

New Member
Joined
May 30, 2014
Messages
35
Hello Experts,

I have single column showing decimal latitude and longitude of some points and they are separated by commas. This column has multiple no of rows but the no of digits after the decimal for each entry is not static. I would like to have code that will read the latitude and longitude separately for upto 5 decimal points and place them in two separate columns for each row entry.

So i have:
[TABLE="width: 500"]
<tbody>[TR]
[TD]54.9208946686,-1.74049906
[/TD]
[/TR]
[TR]
[TD]54.919392,-174418236
[/TD]
[/TR]
[TR]
[TD]54.89470,-1.5778952
[/TD]
[/TR]
[TR]
[TD]54.9547455,-1.737341
[/TD]
[/TR]
</tbody>[/TABLE]

May thanks in advance.

Regards
Syed
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi Syed,

Given that column A holds the latitudes and longitudes, starting from cell A1 -- use these formulae in B1 & C1 respectively:

B1:
=VALUE(MID(SUBSTITUTE($A1,",",REPT(" ",LEN($A1))),(COLUMN()-2)*LEN($A1)+1,SEARCH(".",$A1)+5))

C1:
=VALUE(TRIM(MID(SUBSTITUTE($A1,",",REPT(" ",LEN($A1))),(2-1)*LEN($A1)+1,SEARCH("|",SUBSTITUTE($A1,".","|",2))+4)))
 
Last edited:
Upvote 0
Hi Syed,

Given that column A holds the latitudes and longitudes, starting from cell A1 -- use these formulae in B1 & C1 respectively:

B1:
=VALUE(MID(SUBSTITUTE($A1,",",REPT(" ",LEN($A1))),(COLUMN()-2)*LEN($A1)+1,SEARCH(".",$A1)+5))

C1:
=VALUE(TRIM(MID(SUBSTITUTE($A1,",",REPT(" ",LEN($A1))),(2-1)*LEN($A1)+1,SEARCH("|",SUBSTITUTE($A1,".","|",2))+4)))

Hello Tyija1995,

Thanks. it works.

Regards
Syed
 
Upvote 0
Hi, here's another option you can also try:


Excel 2013/2016
ABC
154.9208946686,-1.7404990654.92089-1.74049
254.919392,-1.7441823654.91939-1.74418
354.89470,-1.577895254.8947-1.57789
454.9547455,-1.73734154.95474-1.73734
Sheet1
Cell Formulas
RangeFormula
B1=TRUNC(LEFT(A1,FIND(",",A1)-1),5)
C1=TRUNC(MID(A1,FIND(",",A1)+1,99),5)
 
Upvote 0
And another version!
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
Book1
ABC
1Processed
2OriginalLatLong
354.9208946686,-1.7404990654.92089-1.74050
454.919392,-1.7441823654.91939-1.74418
554.8947,-1.577895254.89470-1.57790
654.9547455,-1.73734154.95475-1.73734
Sheet1
Cell Formulas
RangeFormula
B3=ROUND(VALUE(LEFT(A3,FIND(",",A3)-1)),5)
C3=ROUND(VALUE(RIGHT(A3,LEN(A3)-FIND(",",A3))),5)
[/FONT]
 
Upvote 0
Solution

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