View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Decimal numbers in Excel

Hi,

Try this to convert decimal degrees to deg, mins & seconds

Alt +F11 to open VB editor, right click 'ThisWorkbook' and insert module and
paste this UDF in

call with

=ConvDeg(a1)

Function ConvDeg(DecAngle) As Variant
Degs = Int(DecAngle)
Mins = (DecAngle - Degs) * 60
secs = Format(((Mins - Int(Mins)) * 60), "0")
ConvDeg = " " & Degs & "° " & Int(Mins) & "' " & secs & """"
End Function

Mike

"Doc" wrote:

Is there a way to separate and use the numbers, to the left of and to the
right of the decimal point in a single cell?
I am trying to convert angles given in decimal form (i.e. 27.286°), to the
older form of degrees, minutes and seconds (i.e. 27°1710), then store the
degrees in one cell, the minutes in another cell, and the seconds in a third.
I can make it work the OTHER way with multiplication and addition, because
that doesnt require the SEPARATION of a number.