Syntax. ATAN2(x_num,y_num)
Definition. This function returns the arctangent based on an x-coordinate or a y-coordinate. The arctangent is the angle between the x-axis and a line through the origin (0, 0) and a point defined by the x-coordinate and y-coordinate.
The angle is returned as a radian measure between –π and π, excluding –π.
Arguments
x_num (required) The x-coordinate of the point
y_num (required) The y-coordinate of the point
Background. The ATAN2() function is another inverse tangent function (see Figure 16-8). However, the result is not calculated based on a tangent but on an xy-coordinate. The result is a radian measure and has to be converted into degrees with the DEGREES() function or by multiplying the result with 180/PI().
A positive result represents a counterclockwise angle from the x-axis; a negative result represents a clockwise angle.
The result of the formula =ATAN2(a,b) equals ATAN(b/a), except that a can equal zero in ATAN2().
If both x_num and y_num are zero, the ATAN2() function returns the #DIV/0!
error.
Examples. This function is used to calculate the angle α based on the calculation of x-coordinates and y-coordinates. More examples for this function are:
=DEGREES(ATAN2(1,2))
returns 85.236º
for angle α.
=DEGREES(ATAN2(-6,-2))
returns -130.601º
for angle α.
=DEGREES(ATAN2(11,2))
returns 10.305º
for angle α.
Sample Files
Use the ATAN2 worksheet in the Chapter16.xls or Chapter16.xlsx sample file. The sample files are found in the Chapter16 folder. For more information about the sample files, see the section titled Using the Sample Files.
3.143.5.201