Skip to content
Excel

ATAN2 function in Excel

Returns the arctangent from x- and y-coordinates

=ATAN2(x_num, y_num)

ATAN2 syntax and parameters

Two arguments, two required.

  • x_numnumberRequired

    The x-coordinate of the point.

  • y_numnumberRequired

    The y-coordinate of the point.

ATAN2 examples

Formulas you'll actually reuse.

  1. The bearing of a point from x and y coordinates — ATAN2 keeps the quadrant:

    =DEGREES(ATAN2(B2, C2))

    Result135

  2. A compass-style 0–360° heading from two points (note x then y):

    =MOD(DEGREES(ATAN2(C2 - C1, B2 - B1)), 360)

    Result225

ATAN2 in Google Sheets

Same name — your formula ports as-is.

Try ATAN2 in the playground

Edit the example — nothing to install.

Preloaded with the ATAN2 formula from Example 1 — change anything and watch it respond.

Loading the editor…

ATAN2 errors

What they mean — and the fixes.

  • #DIV/0!

    Both coordinates are 0 — the angle is undefined at the origin.