+ Reply to Thread
Results 1 to 6 of 6

IF function for converting latitudes in different formats to the same format

  1. #1
    Registered User
    Join Date
    01-17-2019
    Location
    Germany
    MS-Off Ver
    varying
    Posts
    19

    Question IF function for converting latitudes in different formats to the same format

    Hello,
    i need to evaluate a paleo diversity database in RStudio but to be able to do the i need to "clean up" the database first. I do not have much excel experience yet so please excuse my probably mundane questions/requests.

    This is specifically about paleo latitudes (the Q column in the attached excel file)
    In the Database longitudinal and latidutinal coordinates are not provided uniformly. They're usually given in degrees but sometimes they're missing the decimal point. (51.234° = 51234)
    My idea was to solve this by using an IF function as follows:

    IF X > 90 or X< -90 divide by 1000 else return original value

    e.g. if the value is 51.234 it returns 51.234; if the value is -51234 it returns -51,234

    i've already tried to do it myself using the help function but it wouldnt work.
    Attached Files Attached Files

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: IF function for converting latitudes in different formats to the same format

    Part of the issue is that lng/lat values that have decimal "." is stored as string in your sample workbook.
    Highlight values and convert to number.

    Once that's done. Try...
    =IF(ABS(Q8)>90,Q8/1000,Q8)

    See attached.
    Attached Files Attached Files
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    01-17-2019
    Location
    Germany
    MS-Off Ver
    varying
    Posts
    19

    Re: IF function for converting latitudes in different formats to the same format

    Thank you, thats exactly what i needed :D
    i think part of the problem is switching between the english and german version of excel in which "." and "," are interchanged

    how to convert the value to numbers?
    ive tried to set the format to "numbers" for the entire column but all it did was adding a ",00" after all values without a "." (e.g. 51234 -> 51234,00 | 51.234 ->51.234)

    Thanks in advance

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: IF function for converting latitudes in different formats to the same format

    If original has "." instead of ",". Then try something like...
    =IF(ABS(SUBSTITUTE(Q8,".",",")*1)>90,SUBSTITUTE(Q8,".",",")/1000,Q8)

    Or just add another helper column.
    =SUBSTITUTE(Q8,".",",")*1

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: IF function for converting latitudes in different formats to the same format

    Alternatively, try
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-17-2019
    Location
    Germany
    MS-Off Ver
    varying
    Posts
    19

    Re: IF function for converting latitudes in different formats to the same format

    Thanks again
    i went with CK76's 2nd option
    just had to exchange some "," for ";" to get it to work for me

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 9
    Last Post: 05-27-2018, 03:09 AM
  2. Replies: 2
    Last Post: 06-02-2015, 08:42 AM
  3. Replies: 5
    Last Post: 02-08-2013, 11:06 AM
  4. Converting all date formats to one single standard format.
    By booo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-25-2010, 07:14 PM
  5. Converting Formats
    By DairyCreamer in forum Excel General
    Replies: 1
    Last Post: 09-20-2006, 02:36 AM
  6. Help with converting date formats
    By k3639 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-27-2006, 06:25 PM
  7. [SOLVED] Converting US Dates to UK Formats
    By Matt in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-13-2006, 10:00 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1