Practice free

ATAN2 function

ATAN2 gives the direction of a point from the origin as an angle in radians, using both coordinates so it gets the quadrant right. It is used in mapping, bearings and geometry.

Example

Read it as a sentence: find the angle, in radians, of the point whose x value is in D1 (empty, so 0) and whose y value is 1.

Practice this in the app

Syntax

ATAN2(x_num, y_num)

x_num (required)
The x coordinate of the point.
y_num (required)
The y coordinate of the point.

Returns: The angle in radians from the positive x-axis to the point, between -PI and PI.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=ATAN2(1,1) 0.785398163 (1,1)
=ATAN2(-1,0) 3.141592654 (-1,0)
=ATAN2(0,1) 1.570796327 (0,1) note x first
=ATAN2(0,-1) -1.570796327 (0,-1)
=ATAN2("1","1") 0.785398163 Text number
=ATAN2(Data!D1,1) 1.570796327 Blank x, 1
=ATAN2(0,0) #DIV/0! (0,0)
=ATAN2("a",1) #VALUE! Text

The Data sheet these formulas read

A cell that starts with = holds that formula.

Watch out for

  • x comes first, which is the reverse of many other tools.
  • Both arguments zero returns #DIV/0!.

Where it works

Excel
ATAN2 is in every version of Excel from 2007 on.
Google Sheets
Same name, same behaviour for everyday use. Sheets also takes x first, then y.

Part of Math and trig functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .