Math & Trig

ATAN2 Function in Excel

Returns the arctangent from x and y coordinates.

Syntax

  • =ATAN2(x_num, y_num)

Arguments

  • x_num (required): X coordinate
  • y_num (required): Y coordinate

Examples

  • =ATAN2(1, 1) - Angle to point (1,1) - Result: 0.785 (π/4)

ATAN2 in reporting workflows

  • Use absolute references when copying formulas across rows.
  • For conditional totals see [SUMIF](/functions/sumif/) and [SUMIFS](/functions/sumifs/).
  • Filtered lists may need [SUBTOTAL](/functions/subtotal/) instead of SUM on visible cells only.

Common errors

  • #DIV/0! if both are 0

Use cases

  • Coordinate geometry
  • Direction calculation
  • Navigation

Frequently asked questions

  • What is ATAN2 in Excel and how does it work? ATAN2 returns the arctangent (angle) from x and y coordinates. The syntax is =ATAN2(x_num, y_num). Unlike ATAN which takes a single ratio, ATAN2 uses both coordinates to determine the angle in all four quadrants. For example, =ATAN2(1, 1) returns π/4 (45 degrees).
  • What is the difference between ATAN2 and ATAN? ATAN takes a single number (the tangent ratio) and returns an angle between -π/2 and π/2. ATAN2 takes x and y coordinates separately and returns an angle between -π and π, correctly handling all four quadrants. Use ATAN2 when you have coordinates, ATAN when you have a tangent value.
  • How do I use ATAN2 to calculate direction? ATAN2 is perfect for calculating direction from coordinates. For example, if you have a point at (x, y), =DEGREES(ATAN2(x, y)) gives the angle in degrees. Positive x and y = first quadrant (0-90°), negative x and positive y = second quadrant (90-180°), etc.
  • Why does ATAN2 return #DIV/0! error? ATAN2 returns #DIV/0! when both x_num and y_num are 0, because the angle is undefined at the origin. To handle this, use =IF(AND(x=0, y=0), "Undefined", ATAN2(x, y)) or check for zero coordinates before calling ATAN2.
  • How do I convert ATAN2 result to degrees? ATAN2 returns radians. To convert to degrees, use =DEGREES(ATAN2(x_num, y_num)). For example, =DEGREES(ATAN2(1, 1)) returns 45 degrees. Alternatively, multiply by 180/PI(): =ATAN2(x_num, y_num) * 180/PI().

Editorial review

  • Reviewed by Excel.Directory Editorial Team. Updated May 2026.