Skip to main content

Atn function

Table of contents
  1. Syntax
  2. Remarks

Returns a Double specifying the arctangent of a number.

Syntax

Atn(number)

The required number argument is a Double or any valid numeric expression.

Remarks

The Atn function takes the ratio of two sides of a right triangle (number) and returns the corresponding angle in radians. The ratio is the length of the side opposite the angle divided by the length of the side adjacent to the angle.

[NOTE!] This is the equivalent of the ATAN() function in Excel. Oddly, Excel.WorksheetFunctions.ATAN() does not exist (as with other Excel formula functions). You can instead use this VBA Atn() function.

The range of the result is -pi/2 to pi/2 radians. To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>