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.
Syntax
| Argument | Description | |
|---|---|---|
x_num | Required | The x-coordinate of the point. |
y_num | Required | The 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):
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
Pick a ATAN2 example to see the formula and its result.
Practice workbook
Frequently asked questions
What is the argument order for ATAN2 in Excel?
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?
Why does ATAN2(1,1) give 0.7854?
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