+ Reply to Thread
Results 1 to 5 of 5

Best way to convert Degrees Minutes and Seconds to Decimal of Degrees (and Vice Versa)

  1. #1
    Registered User
    Join Date
    08-04-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    20

    Question Best way to convert Degrees Minutes and Seconds to Decimal of Degrees (and Vice Versa)

    I have found the following excel function code on the internet:


    Please Login or Register  to view this content.
    The above function code requires the manual (and tedious) input of the degree symbol "º" pasted into every cell for the angular value.

    I have cell values custom formatted using Custom Type: [h]º mm' ss.0\" to represent the angular values the user inputs (trying to remove the need to do the previous sentence).

    This obviously does not work as the actual cell values are in units of time.

    How do I get the above function code to use the [h]º mm' ss.0\" cell value?

    As the cell input is in degrees, minutes and seconds, I do not see how I can simply multiply the value by 24 (in the function code) as the input value is not decimal degrees (thus, conversion won't hold true).

    Any ideas?

    Thanks,

    Aussie_Student
    Last edited by Aussie_Student; 08-05-2017 at 01:58 AM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Best way to convert Degrees Minutes and Seconds to Decimal of Degrees (and Vice Versa)

    I understand Ford's post as accepting answers to the thread again (indeed there are problems with editing today)

    So I'm posting what I had ready, but not sent, because I noticed AliGW post

    ---

    Two comments
    - merit one:
    If I understand you well you have in a cell 15:05:13 displayed (formatted) as 15º 05' 13.0" - then indeed you can simply multiply value by 24
    Please Login or Register  to view this content.
    Try it. It's working as seen on the screenshot attached
    - administrative: please edit your post and use code tags, not just italics for the code it improves readability and gives a tool to easy copy all code - moreover it is formal requirement here: Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between
    Please Login or Register  to view this content.
    tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here: https://www.excelforum.com/forum-rul...rum-rules.html
    Attached Images Attached Images
    Best Regards,

    Kaper

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Best way to convert Degrees Minutes and Seconds to Decimal of Degrees (and Vice Versa)

    PS. note that function argument is no longer String, but Date now.

    (It's separate post, because again trying editing, I got empty message box)

    As for vice versa - yes, you can just divide by 24, store as date/time and use custom formatting
    Last edited by Kaper; 08-05-2017 at 01:46 AM.

  4. #4
    Registered User
    Join Date
    08-04-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    20

    Re: Best way to convert Degrees Minutes and Seconds to Decimal of Degrees (and Vice Versa)

    Hi Kaper,

    Thank you for the PM.

    Just before I received the updates and your PM I tried and confirmed that if I formatted another cell as general, referenced the DMS value and divided it by 24 it converted the value in to DD.

    The post is now in the proper format.

    Thank you again and I will use the code descriptor from now on.

    Aussie_Student
    Last edited by Aussie_Student; 08-05-2017 at 01:59 AM.

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Best way to convert Degrees Minutes and Seconds to Decimal of Degrees (and Vice Versa)

    Indeed it was so in the morning, but Just few seconds ago I edited another post and it worked. Hope it was just temporary problem.

+ 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. D2dms
    By sanju2323 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-12-2017, 09:18 PM
  2. Replies: 4
    Last Post: 07-26-2016, 09:06 AM
  3. [SOLVED] how can i convert degrees/minutes/seconds to decimal degrees?
    By russkris in forum Excel General
    Replies: 14
    Last Post: 03-03-2015, 04:32 AM
  4. [SOLVED] Convert GPS Degrees Minutes Seconds to Decimal
    By Nelson.B22 in forum Excel Formulas & Functions
    Replies: 22
    Last Post: 02-03-2014, 11:39 PM
  5. [SOLVED] convert decimal degrees to degrees minutes seconds
    By Chris r in forum Excel General
    Replies: 6
    Last Post: 12-06-2013, 06:24 AM
  6. Converting Lat/Long (Degrees Minutes Seconds) to Decimal Degrees
    By Jeremy Rayne in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2008, 06:02 PM
  7. Replies: 2
    Last Post: 04-28-2006, 07:20 AM

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