View Single Post
 
Old 04-23-2012, 03:13 AM
Catalin.B Catalin.B is offline Windows Vista Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, România
Posts: 386
Catalin.B is on a distinguished road
Default

Quote:
Originally Posted by Jamal NUMAN View Post
How do I use it to convert the decimal angles to DMS? Could you please elaborate more?
I think that the second part of my issue is still not solved. What if I need to insert the 35º12’14’’ directly to the cell? Do I need in this case to convert it first to decimal and then using the code to convert it to DMS?
Best
Jamal
Copy those functions in a VB module. Then, to convert to degree, in cell A3 of your worksheet use the formula: =Convert_Degree(A1) to convert a decimal value from cell A1 to angular value, displayed as DMS. This is now, a text string in A3, not a value! So if you need to 2 cells that looks like 15°19'55,2" you have to convert these text strings back to a decimal value, add them, then convert them to a sexagesimal value, to be displayed in DMS. Assuming that you have 19°22'37,2" in A1 and 15°19'55,2" in A2, the formula to sum A1+A2 in A3 should look like:
=Convert_Degree(Convert_Decimal(A1)+Convert_Decima l(A2))
You can enter a value in DMS as a text string, which will be transformed in calculations in decimal.
If in A1 is a decimal value, and in A2 a value inserted by you, like 35º12’14’’, then use in A3 the functions like this(convert A2 to decimal, add it to A1, then convert the result to be displayed as DMS):
=Convert_Degree(A1+Convert_Decimal(A2))
But, you have another option from Paul, which is a great answer, i am ashamed that i did not realised that sexagesimal circle matches perfectly the time circle and DMS can be displayed by formatting the decimal value to a custom time format [hh]ºmm'ss.00''. With this format, the results can be simply added and the cell formatted to display DMS
As Paul sugested, use (A1+A2)/24 in a custom formatted cell and you will have the same answer as the UDF. The problem with this approach is that you cannot enter a value in DMS, values can only be entered in decimal system. And another minus is that this can be applied only to sexagesimal system, will not work on centesimal system (at least i think so... )To work on centesimal system , the functions are easy to modify, replacing 60 with 100 and 3600 with 10000.
Reply With Quote