Quick Answer

ATAN2 Function

Returns the angle in radians to a point given by its x and y coordinates.

✓ Excel✓ Google SheetsExcel All versions

Syntax

ATAN2
(x_num, y_num)

Parameters

ParameterDescriptionRequired
x_numThe x-coordinate of the point. NOTE: Excel lists x first, the opposite of the common math atan2(y, x) convention.Required
y_numThe y-coordinate of the point.Required

Basic Example

Angle to the point (1, 1)

=ATAN2(1, 1)
Result0.785398163

The point (1,1) sits at 45°, which is π/4 radians. Note x_num=1 is given before y_num=1.

Advanced Examples

Example 1: Convert to degrees for a quadrant check

Find the compass-style angle of a vector.

Wrap in DEGREES.

=DEGREES(ATAN2(1, 1))
Result: 45
ATAN2(1,1) returns π/4 radians, converted to 45°.

Example 2: Negative coordinates land in the third quadrant

Point (-1, -1).

Both coordinates negative produce a negative angle.

=ATAN2(-1, -1)
Result: -2.35619449
The angle to (-1,-1) is -135° (or -3π/4 radians), inside ATAN2's -π to π range.

How ATAN2 Works

ATAN2(x_num, y_num) returns the angle θ (in radians, from -π to π) between the positive x-axis and the line from the origin to (x_num, y_num). It uses the signs of both coordinates to place the result in the correct quadrant, avoiding the division-by-zero problem of ATAN(y/x). In Excel the first argument is x_num and the second is y_num.

1
Identify coordinates
Determine the x and y values of your point.
2
Enter the formula
Type =ATAN2(x_num, y_num), x first.
3
Press Enter
The angle in radians appears; use DEGREES for degrees.

Important Notes & Limitations

  • Both coordinates cannot be zero; ATAN2(0, 0) returns #DIV/0!.

  • The result is in radians from -π to π.

  • Excel's argument order is (x_num, y_num) — the reverse of the common mathematical atan2(y, x) — which is a frequent source of sign errors.

Common Errors & Fixes

#DIV/0!Both x_num and y_num are 0.

Fix: Ensure at least one coordinate is non-zero.

Wrong quadrant angleArguments swapped (y before x) by mistake.

Fix: Remember Excel expects x_num first, then y_num.

Download Practice File

Practice ATAN2 with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the ATAN2 function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

Why does Excel put x before y?
Excel's signature is ATAN2(x_num, y_num), which is the reverse of the typical math notation atan2(y, x). Keep this in mind to avoid sign errors.
What range of angles does ATAN2 return?
From -π to π radians (-180° to 180°), covering all four quadrants.
When should I prefer ATAN2 over ATAN?
Whenever you have separate x and y coordinates, because ATAN2 determines the correct quadrant, while ATAN(y/x) loses that information.