Arctan Excel Functions: Use ATAN and ATAN2 to Calculate Inverse Tangent

There are two functions for calculating the inverse tangent or arctan in Excel. These two functions are ATAN and ATAN2 (“atan” is short for arctangent), and they each have specific uses depending on the desired results that you’d like to obtain and the inputs available. In general, I’d recommend using ATAN if:

  • You are only concerned with the first quadrant of the unit circle
  • You don’t know the x- and y-values

However, use the ATAN2 function if:

  • You want to return angles in all four quadrants of the unit circle
  • You know the x- and y-values

Using ATAN to Calculate Arctan in Excel

The ATAN function returns a result between -π/2 and π/2 radians (or -90 and 90 degrees), or in other words, in the first and fourth quadrants.

The syntax is:

ATAN(number)

There is only one argument to ATAN: the number from which you want to calculate the inverse tangent. And since there is only one argument, Excel cannot determine which quadrant the solution should be in.

To demonstrate this, I’ve set up a unit circle in a spreadsheet, shown below, by creating a series of angles from 0 to 360 degrees and calculating the x- and y-values using the functions COS and SIN, respectively:

inverse tangent excel

Next, I calculated the inverse tangent of y over x using ATAN, and since Excel works with angles in units of radians, I converted the result to degrees with the DEGREES function. The formula looked like this:

=DEGREES(ATAN(y/x))

arctan excel atan

There are a few things to notice here:

  1. The absolute values of the angles never exceed 90 degrees, and
  2. Values in the second (II) quadrant in column C are now in the fourth quadrant in column F.
  3. Values in the third (III) quadrant in column C are now in the first quadrant in column F.

Plotting the results on the unit circle looks like this:

As you can see, Excel has limited the results to the first and fourth quadrants. Why did this happen?

Since there is only one argument to the ATAN function, Excel calculates the value of y/x before if evaluates the ATAN function.

It cannot determine, then, whether the input to ATAN is negative because the x-value or the y-value is negative. Therefore, it can’t tell if the result should be in the second quadrant or the fourth quadrant, so it just defaults to the fourth quadrant.

Likewise, when the input value is positive, the original quadrant could be either the first (both x and y positive) or third (both x and y negative).

We could use a complex nested IF function to get the results back into all four quadrants, but fortunately Excel has another function called ATAN2 to help us out.

Using ATAN2 to Calculate Arctan in Excel

The ATAN2 function can also be used to calculate the inverse tangent in Excel. This function returns a result between -π and π radians (or -180 and 180 degrees), using all four quadrants. The syntax is:

ATAN2(x_num,y_num)

There are two arguments:

  • An x-value “x_num”
  • A y-value “y_num”

By inputting two values to the function, Excel can determine which quadrant the value belongs in.

  • Quadrant 1 if both x and y are positive
  • Quadrant 2 if x is negative and y is positive
  • Quadrant 3 if both x and y are negative
  • Quadrant 4 if x is positive and y is negative

So if we use the formula

=DEGREES(ATAN2(x_num,y_num))

We get the following results:

arctan in excel atan2

And plotted on the unit circle, the results look like this:

So clearly, this function is returning values in all four quadrants. However, if we’d prefer to have the results in terms of an angle from 0 to 360 degrees rather than -180 to 180, we can use a simple IF function to add 360 if the result is less than 0.

=IF(result<0,result+360,result)

Wrap-Up

Hopefully, now you understand the limitations of ATAN and when it’s better to use ATAN2 to calculate the inverse tangent or arctan in Excel.

In general, use ATAN if:

  • You are working only in the first quadrant
  • You don’t know the x- or y-values

Use the ATAN2 function if:

  • You need the angles in all four quadrants
  • The x- and y-values are known
Scroll to Top