How to Use the ATAN2 Function in Google Sheets

This guide will explain how to use the ATAN2 function in Google Sheets.

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.

sample coordinates for ATAN2 function in google sheets

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)
using atan2 function in google sheets to find the arctangent given x y coordinates

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.

use DEGREES function to convert radians to degrees

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

  1. Select the cell where you want to place the ATAN2 function.
    select a cell to output the arctangentIn 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.
  2. Type the ATAN2 function and enter the cell references for the x-coordinate and y-coordinate.
    type the atan2 function in google sheets
  3. Hit the Enter key to evaluate the ATAN2 function.
    hit the enter key
  4. Use the AutoFill feature to copy the ATAN2 function onto the remaining cells in Column C.
    drag formula
  5. We can input the ATAN2 result as an argument of the DEGREES function to convert the value from radians to degrees. In cell D2, we used the formula DEGREES(C2).
    use DEGREES function to convert radians to degreesWe 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-in PI 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

  1. What is the difference between the ATAN and ATAN2 functions?
    The main difference between the ATAN function and ATAN2 function is the number of arguments they can accept and the range of values they can output. The ATAN function accepts a single value and returns an angle between -pi/2 and pi/2.
    Meanwhile, the ATAN2 function takes two values: an x-coordinate and a y-coordinate. The output range of the ATAN2 function is between -pi to pi.
  2. What is the advantage of using the ATAN2 function over ATAN?
    The ATAN2 function is best used for applications involving coordinate systems since it can accept a vertical and horizontal component for a given value. The ATAN2 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! 

Get emails from us about Google Sheets.

Our goal this year is to create lots of rich, bite-sized tutorials for Excel users like you. If you liked this one, you'd love what we are working on! Readers receive early access to new content.

0 Shares:
Leave a Reply

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

You May Also Like