Converting Decimal Degrees to D:M:S in excel

Posted on 2016-09-07
Last Modified: 2016-09-09
Can someone explain why I'm getting rounding errors in the attached spread sheet?  DDtoDMS.xlsx

I'm expecting column 'T' to look like this


Open in new window

If E3 =0.55 and F3 = "E3*60"/33 so how can G3 = "INT(F3)" / 32?

My maths might be dodgy but 0.55 *60 = 33

Also how do I fix the leading zeros in the output?
Question by:trevor1940
  • 4
  • 2
LVL 32

Expert Comment

by:Rob Henson
ID: 41788098
That is bizarre to say the least!!

If you copy E2 and paste values elsewhere, it gives 0.549999999999997 hence why that value multiplied by 60 doesn't give an exact 33.

Change the formula in E2 to:


That sorts it.

I don't see any leading zeros in the output.

Rob H
LVL 32

Expert Comment

by:Rob Henson
ID: 41788120
To force the numbers to show as a certain number of digits, you can use the TEXT function, your end result formula becomes:


Change the number of 0 in the " " to affect how the number appears.
LVL 32

Accepted Solution

Rob Henson earned 400 total points
ID: 41788168
Alternatively, this formula gives the same result but without using helper columns, ie just using Decimal Degrees and Hemisphere columns (A & B and J & K):


In addition, your Hemisphere calculations can be simpler:

North/South =IF(A2<0,"S","N")
East/West =IF(J2<0,"W","E")

That could even be incorporated into the main formula so just using the Decimal Degrees in columns A & J:



EDITED 17:31: To correct missing ABS statements
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

LVL 19

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 100 total points
ID: 41788283
Looking at formula in K:
use the ROUND function on values in column I and R. Internally, Excel is storing values as double-precision data type, which is stored in exponential format and therefore, not precise. Any calculation made should be rounded to the desired precision as that is not implicitly determined by the factors.

Author Comment

ID: 41788339
Hi Rob

If you copy E2 and paste values elsewhere, it gives 0.549999999999997 hence why that value multiplied by 60 doesn't give an exact 33.

Change the formula in E2 to:


Any idea why this happening?

Thanx for your 1 cell solution very neat I had opened up my solution to work where this error was

BTW Latitude can only be 2 digits for degrees only saying


use the ROUND function on values in column I and R. Internally,

How will that help?  hasn't the damage already been made at this point?

I don't understand how 42.55 - 42 doesn't = 0.55?  is there a format setting some where causing this error?
LVL 32

Expert Comment

by:Rob Henson
ID: 41789688
Crystal has answered the question as why Excel is doing this, much as it is annoying I don't think there is a lot that can be done about it other than allowing for it with ROUND functions.

Author Closing Comment

ID: 41790802
Thanx for you help and explanation

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question