6

Looking at the image below I want to extract the Lats and Longs from the "geohash,latitude,longitude" column.

I can't just use the function RIGHT(C2,LEN(C2)-8) because the Lats & Longs are different lengths and I'll have to go through the entire column E manually adding any numbers that have been removed.

Example picture:

PeterH
  • 7,377
  • 20
  • 54
  • 82
wilga
  • 79
  • 5

4 Answers4

11
  1. Select the whole column and copy it on the next empty column, suppose it is columnE.

  2. Select Column E.

  3. Go to Data -> Text To Columns.

enter image description here

  1. Select Delimited

enter image description here

  1. Select Comma,

enter image description here

  1. Click Next and Finish
jcbermu
  • 17,278
  • 2
  • 52
  • 60
4

You can use FIND, MID & LEFT Functions for this.

Use this for Lat:

=LEFT(MID(C1,FIND(",",C1)+1,100),FIND(",",MID(C1,FIND(",",C1)+1,100))-1)

& Use this for Long:

=MID(MID(C1,FIND(",",C1)+1,100),FIND(",",MID(C1,FIND(",",C1)+1,100))+1,100)

Then simply drag them both down.

If you want to return them as Integers, use +0 at the end of the formulas, else they will be strings.

PeterH
  • 7,377
  • 20
  • 54
  • 82
3

You can use the FIND()-function to get the position of the commas and after that split the string for latitude and longitude.

So can use for latitude
=MID(A2, FIND(",", A2)+1, FIND(",", A2, FIND(",", A2)+1)-1)

and for longitude
=RIGHT(A2, LENGTH(A2)-FIND(",", A2, FIND(",", A2)+1))

IQV
  • 666
  • 4
  • 12
2

This single Formula will extract both Latitude and Longitude.

In Cell D2 write this Formula.

enter image description here

=TRIM(MID(SUBSTITUTE($C2,",",REPT(" ",999)),COLUMNS($C:C)*998,999))

NB: Finish with Enter you find the Latitude then just drag or Copy the Formula to adjacent Cell (one cell Right) you get Longitude and finally drag it down till is necessary.

I do believe this help you.

Rajesh Sinha
  • 8,995
  • 6
  • 15
  • 35