To calculate arctangent in Excel, use =ATAN(number) when you already have one tangent ratio, such as rise divided by run. Excel returns the angle in radians. If you want degrees, wrap the formula in DEGREES: =DEGREES(ATAN(number)). For example, =DEGREES(ATAN(1)) returns 45.
Use ATAN for one tangent ratio
The Microsoft ATAN function reference gives the syntax as ATAN(number). The argument is the tangent ratio. For a finite number, the principal angle returned is strictly between -PI()/2 and PI()/2, or between -90 and 90 degrees. This single ratio cannot identify every possible quadrant. The DEGREES function converts a radians angle into degrees.
| If A2 contains | Radians formula | Radians result | Degrees formula | Degrees result |
|---|---|---|---|---|
1 | =ATAN(A2) | 0.785398163 | =DEGREES(ATAN(A2)) | 45 |
0.5 | =ATAN(A2) | 0.463647609 | =DEGREES(ATAN(A2)) | 26.56505118 |
-1 | =ATAN(A2) | -0.785398163 | =DEGREES(ATAN(A2)) | -45 |
If your worksheet has opposite and adjacent lengths, calculate the ratio first. For example, if A2 is the opposite side and B2 is the adjacent side, use =DEGREES(ATAN(A2/B2)). This is fine when the sign and quadrant are not ambiguous. It is not enough when you need the full coordinate direction.
Use ATAN2 when you have x and y coordinates
The Microsoft ATAN2 function reference gives the syntax as ATAN2(x_num, y_num): the x-coordinate comes first, and the y-coordinate comes second. The result is in radians from -PI() to PI(), excluding -PI(). A positive result is counterclockwise from the x-axis; a negative result is clockwise.
Check the argument order when translating a formula from another program. In Python and many programming examples, the common call is math.atan2(y, x). The Python math.atan2 documentation uses atan2(y, x). To reproduce the same coordinate angle in Excel, write =ATAN2(x, y), not =ATAN2(y, x).
For the next table, start a separate worksheet: label A1 x_num and B1 y_num, then enter the coordinate pairs in A2:B8 in the displayed order. The formula in each row refers to that row’s x and y values.
| x_num | y_num | Excel formula | Radians result | Degrees formula | Degrees result |
|---|---|---|---|---|---|
1 | 1 | =ATAN2(A2,B2) | 0.785398163 | =DEGREES(ATAN2(A2,B2)) | 45 |
-1 | 1 | =ATAN2(A3,B3) | 2.35619449 | =DEGREES(ATAN2(A3,B3)) | 135 |
-1 | -1 | =ATAN2(A4,B4) | -2.35619449 | =DEGREES(ATAN2(A4,B4)) | -135 |
0 | 1 | =ATAN2(A5,B5) | 1.570796327 | =DEGREES(ATAN2(A5,B5)) | 90 |
0 | -1 | =ATAN2(A6,B6) | -1.570796327 | =DEGREES(ATAN2(A6,B6)) | -90 |
-1 | 0 | =ATAN2(A7,B7) | 3.141592654 | =DEGREES(ATAN2(A7,B7)) | 180 |
0 | 0 | =ATAN2(A8,B8) | #DIV/0! | =DEGREES(ATAN2(A8,B8)) | #DIV/0! |
The zero-x cases are the reason ATAN2 is safer than writing ATAN(y/x). The Microsoft Learn ATAN2 remarks document that when x = 0 and y > 0, ATAN2(x,y) is PI()/2; when x = 0 and y < 0, it is -PI()/2; when both are zero, it returns an error value. In an Excel worksheet, the support page names that error as #DIV/0!.
If you want 0 to 360 degrees
ATAN2 returns angles in the signed range, so a point such as (1,-1) gives -45 degrees. If your plot needs angles from 0 up to (but not including) 360 degrees, convert the signed result after calculating it. This still measures counterclockwise from the positive x-axis; it does not change the reference direction to a north-based clockwise compass bearing:
=LET(angle,DEGREES(ATAN2(A2,B2)),IF(angle<0,angle+360,angle))
For older Excel versions without LET, use the same logic in two cells or repeat the expression:
=IF(DEGREES(ATAN2(A2,B2))<0,DEGREES(ATAN2(A2,B2))+360,DEGREES(ATAN2(A2,B2)))
Both formulas keep ATAN2(0,0) as an error: the origin has no defined direction. A formula showing 315 degrees for (1,-1) is the same direction as -45 degrees.
Do not skip radians when using TAN
ATAN is the inverse of tangent, but Excel's tangent function also uses radians. The Microsoft TAN function reference says TAN(number) expects an angle in radians. If your input angle is in degrees, convert it with RADIANS first.
| Goal | Formula | Expected result |
|---|---|---|
| Tangent of 45 degrees | =TAN(RADIANS(45)) | 1 |
| Recover the angle from that tangent | =DEGREES(ATAN(TAN(RADIANS(45)))) | 45 |
| Incorrect if you meant 45 degrees | =TAN(45) | about 1.619775; 45 is treated as radians, not degrees |
The round trip only recovers angles in ATAN’s principal range. For example, =DEGREES(ATAN(TAN(RADIANS(135)))) gives approximately -45, not 135, because tangent repeats every 180 degrees. Keep the original coordinates and use ATAN2 when the quadrant matters.
The examples use English Excel function names and comma separators. If your Excel expects semicolons, use that argument separator; do not swap the x and y positions. Decimal separators follow your regional settings too.
Do not confuse ATAN with ATANH
ATAN means inverse tangent. ATANH is different: the Microsoft ATANH function reference says it returns the inverse hyperbolic tangent and its number must be between -1 and 1, excluding both endpoints. Use ATANH only when you actually need a hyperbolic function, not for a normal triangle angle.
So the short answer is: use =DEGREES(ATAN(A2)) for one tangent ratio in A2; use =DEGREES(ATAN2(x_cell,y_cell)) when you have separate x and y coordinates and need the correct quadrant.