The ATAN2 function in Google Sheets is a powerful tool for calculating the angle of a point in relation to the x-axis. It effectively returns the arctangent of the two specified coordinates, allowing users to determine the orientation of a vector defined by these coordinates.
Syntax
ATAN2(y, x)
- y: The vertical coordinate of the point.
- x: The horizontal coordinate of the point.
Example #1
=ATAN2(1, 1)
This function calculates the angle between the line to the point (1, 1) and the x-axis. The result is approximately 0.785 radians, which corresponds to 45 degrees.
Example #2
=ATAN2(-1, -1)
In this instance, the function determines the angle to the point (-1, -1), resulting in approximately -2.356 radians, which points to the direction of 225 degrees.
Example #3
=ATAN2(0, 1)
This calculation evaluates the angle to the point (0, 1), giving a result of 0 radians, indicating a direct upward orientation along the y-axis.
Error handling
- DIV/0! This error occurs if both parameters are zero; the function cannot determine an angle in this case.
- VALUE! This error arises if either of the inputs is non-numeric, as the function expects numerical values.