Excel ATN Function
The Excel ATN function returns arctangent (inverse tangent) of a number. It returns result expressed in radians.
The ATN function is a built-in function in Excel that is categorized as a Math/Trig Function. It can be used as a VBA function in Excel. As a VBA function, this function can be used in a Excel macro code. The Excel macro code can be created using the Microsoft Visual Basic Editor.
Syntax
ATN(number)
Parameters
number |
Required. Specify the value to get the arctangent of. |
Return Value
Returns the arctangent of a value.
Notes
- To convert the result in degrees, multiply it by 180/PI or use the DEGREES function.
Example: Using as VBA Function
The ATN function can be used in VBA code in Microsoft Excel. Consider the example below:
Dim FValue As Double FValue = ATN(1)
In this example, the variable called FValue will contain the value of 0.785398163397448.
Similarly, for the different input the VBA code will give the following output:
ATN(2) Result: 1.107148718 ATN(2.5) Result: 1.19028995 ATN(0) Result: 0 ATN(-2) Result: -1.107148718 ATN(-2.5) Result: -1.19028995
Example: Convert Result to Degrees
To get the result from ATN function in degrees, the result can be multiplied by 180/PI. Alternatively, the angle can be converted into degrees by using DEGREES function. For example, to convert 2 radians into degrees, the following expression can be used in VBA code:
2 * 180 / WorksheetFunction.Pi Result: 114.591559026165 WorksheetFunction.Degrees(2) Result: 114.591559026165
❮ Excel Functions