Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Entering Angles in Excel 1

Status
Not open for further replies.

markgrizzle

Programmer
Aug 3, 2003
288
US
I need to calculate the tangent of zero degrees, 12 minutes, 34 seconds, but can't figure out how to enter it. I'd search for it, but the search function here isn't working. Anyone have an answer? Thanks
 
Hi,

Make a cell for each: degrees, minutes and seconds.

Skip,

[red]Be advised:[/red] [glasses]
Alcohol and Calculus do not mix!
If you drink, don't derive! [tongue]
 
Thanks Skip, I also found the following code in the microsoft support site.

Function Convert_Decimal(Degree_Deg As String) As Double
' Declare the variables to be double precision floating-point.

Dim degrees As Double
Dim minutes As Double
Dim seconds As Double

' Set degree to value before "°" of Argument Passed.
degrees = Val(Left(Degree_Deg, InStr(1, Degree_Deg, "°") - 1))

' Set minutes to the value between the "°" and the "'"
' of the text string for the variable Degree_Deg divided by
' 60. The Val function converts the text string to a number.

minutes = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "°") + 2, _
InStr(1, Degree_Deg, "'") - InStr(1, Degree_Deg, _
"°") - 2)) / 60

' Set seconds to the number to the right of "'" that is
' converted to a value and then divided by 3600.

seconds = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "'") + _
2, Len(Degree_Deg) - InStr(1, Degree_Deg, "'") - 2)) _
/ 3600

Convert_Decimal = degrees + minutes + seconds

End Function

Function Convert_Degree(Decimal_Deg) As Variant

With Application

'Set degree to Integer of Argument Passed
degrees = Int(Decimal_Deg)

'Set minutes to 60 times the number to the right
'of the decimal for the variable Decimal_Deg

minutes = (Decimal_Deg - degrees) * 60

'Set seconds to 60 times the number to the right of the
'decimal for the variable Minute

seconds = Format(((minutes - Int(minutes)) * 60), "0")

'Returns the Result of degree conversion
'(for example, 10.46 = 10~ 27 ' 36")

Convert_Degree = " " & degrees & "° " & Int(minutes) & "' " _
& seconds + Chr(34)

End With

End Function


 
You can make data display simple by using a modification of time format. Select the cells for data entry, then open to Format...Cells...Custom format menu item. Use format string: [hh]"°" mm"'" ss"''"

To enter an angle, use the : character to separate the pieces: 14:32:25 would be 14° 32' 25"

To calculate the tangent, use either of the formulas:
=TAN(A1*24*PI()/180)
=TAN(A1*PI()/7.5)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top