This guide will explain how to use the ATAN2 function in Google Sheets.
Table of Contents
The arctangent, or inverse tangent, refers to the angle from the x-axis to a line passing through the origin (0, 0).
We can think of the line passing through the origin as also passing through some point (x, y) as well. To solve for the arctangent given the vertical and horizontal components, we can use the ATAN2
function in Google Sheets.
In this guide, we will provide a step-by-step tutorial on using the ATAN2
function to find the arctangent given a set of x and y coordinates. We’ll also explain how to convert the result from radians to degrees.
The Anatomy of the ATAN2 Function
The syntax of the ATAN2
function is as follows:
=ATAN2(x,y)
Let’s look at each argument to understand how to use the ATAN2
function.
- x refers to the x-coordinate of the endpoint of the line segment that you want to calculate the angle of
- y refers to the y-coordinate of the endpoint of the line segment you want to calculate the angle of
- If both x and y are 0,
ATAN2
returns a #DIV/0! error value. - We recommend using the
ATAN
function instead to find the arctangent given a single value.
A Real Example of the ATAN2 Function in Google Sheets
Let’s explore a few simple examples of the ATAN2
function in action.
In the table above, we have a dataset of x-coordinates and y-coordinates representing a set of points on a Cartesian plane. We want to fill Column C with the arctangent of each given input.
We can find the arctangent of a pair of x and y coordinates by using the ATAN2
function. We’ll use the following formula to calculate the arctangent of the point with the coordinates (-1, 5):
=ATAN2(A2,B2)
Our formula returns a value of about 1.768. The output is represented in radians which is a unit of measurement for angles commonly used in trigonometry.
We can convert the result to degrees by using the DEGREES
function.
In the example above, we created a fourth column to show our arctangent in terms of degrees. We can use the following formula to perform the conversion:
=DEGREES(C2)
We can also convert radians to degrees by using the following formula:
=C2*180/PI()
Click on the link below to create your own copy of our examples.
Head to the next section to read our step-by-step tutorial on how to use the ATAN2
function in Google Sheets.
How to Use The ATAN2 Function in Google Sheets
- Select the cell where you want to place the
ATAN2
function.
In this example, we want to fill column C with the corresponding inverse tangent of each x and y coordinate. We’ll start by adding a formula in cell C2. - Type the
ATAN2
function and enter the cell references for the x-coordinate and y-coordinate. - Hit the Enter key to evaluate the
ATAN2
function. - Use the AutoFill feature to copy the
ATAN2
function onto the remaining cells in Column C. - We can input the
ATAN2
result as an argument of theDEGREES
function to convert the value from radians to degrees. In cell D2, we used the formula DEGREES(C2).
We can also convert from radians to degrees by multiplying the value in radians by 180 and dividing the result by the value of pi. Google Sheets includes a built-inPI
function that will automatically output the value of pi.
In the example above, we used the formula =C2*180/PI().
These are all the steps you need to know to start using the ATAN2
function in Google Sheets.
FAQs
- What is the difference between the ATAN and ATAN2 functions?
The main difference between theATAN
function andATAN2
function is the number of arguments they can accept and the range of values they can output. TheATAN
function accepts a single value and returns an angle between -pi/2 and pi/2.
Meanwhile, theATAN2
function takes two values: an x-coordinate and a y-coordinate. The output range of theATAN2
function is between -pi to pi. - What is the advantage of using the ATAN2 function over ATAN?
TheATAN2
function is best used for applications involving coordinate systems since it can accept a vertical and horizontal component for a given value. TheATAN2
function also automatically handles which quadrant to compute the angle from by considering the signs of the x and y components.
To learn more about other trigonometric functions, you can read our post on how to find the inverse hyperbolic cosine in Google Sheets.
That’s all for this guide! Be sure to check out our library of spreadsheet resources, tips, and tricks!