ATAN2 Function

Excel Functions › Math & Trig

All versions Math & Trig

The Excel ATAN2 function returns the arctangent of the point (x, y) — the angle from the positive x-axis to that point. Unlike ATAN it knows the quadrant, returning a full -π to π range in radians.


Quick answer:
=DEGREES(ATAN2(1,1)) point (1,1) = 45 degrees

Syntax

=ATAN2(x_num, y_num)
ArgumentDescription
x_numRequiredThe x-coordinate of the point.
y_numRequiredThe y-coordinate of the point. Note the order is (x, y) — the reverse of the usual math notation atan2(y, x).

How to use it

ATAN2 takes both coordinates of a point and returns the angle to it, measured counter-clockwise from the positive x-axis. Because it sees both x and y, it places the angle in the correct quadrant — the full to π range (−180 to 180 degrees):

=ATAN2(1, 1) // pi/4 radians = 0.7854
=DEGREES(ATAN2(1, 1)) // = 45 degrees
=DEGREES(ATAN2(-1, 1)) // = 135 degrees

Watch the argument order: Excel uses ATAN2(x_num, y_num) — x first — which is the reverse of the atan2(y, x) convention used in most programming languages and math texts. Both x_num and y_num being 0 returns #DIV/0!.

Argument order surprise: Excel's ATAN2 is (x, y), but nearly every programming language uses atan2(y, x). Swapping them gives a different (often wrong) angle, so double-check the order.

Try it: interactive demo

Live demo

Pick a ATAN2 example to see the formula and its result.

Result:

Practice workbook

📊
Download the free ATAN2 practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What is the argument order for ATAN2 in Excel?
Excel uses ATAN2(x_num, y_num) — the x-coordinate first. This is the opposite of the atan2(y, x) order used in most programming languages.
How is ATAN2 different from ATAN?
ATAN only sees a single ratio and returns −90 to 90 degrees. ATAN2 sees both coordinates, so it knows the quadrant and returns the full −180 to 180 degrees.
Why does ATAN2(1,1) give 0.7854?
That is π/4 radians, the angle to the point (1,1). Wrap it in DEGREES(ATAN2(1,1)) to read 45 degrees.
What happens if both x and y are zero?
=ATAN2(0, 0) is undefined and returns a #DIV/0! error, since there is no defined angle to the origin.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: ATAN · TAN · DEGREES · RADIANS · ASIN · ACOS