Knowledge base / Excel

Excel ATAN: radians, degrees and the ATAN2 difference

I explain how a slope becomes an angle, when ATAN2 is needed and why Excel's coordinate order matters.

Kajo RudzińskiPublished Updated 4 min read

A yellow drafting mechanism forms a triangle and marks its slope angle

When I know a slope and need an angle, I use ATAN. It takes one number and returns its arctangent in radians. The function is named ATAN in both English and Polish Excel. The Microsoft documentation specifies its input and output units.

I will use small synthetic examples: equal triangle sides, a negative slope and a direction described by coordinates. That last case requires distinguishing ATAN from ATAN2. Similar names do not imply identical inputs.

ATAN takes the tangent of an angle

=ATAN(1)

The argument is the tangent of the angle you want. For one, the result is approximately 0.785398163 radians, equivalent to forty-five degrees. In a right triangle, the opposite side divided by the adjacent side then equals one. Equal side lengths make that ratio easy to see.

ATAN does not take an angle in degrees. Entering forty-five asks for an angle whose tangent is forty-five. It does not convert forty-five degrees. That is the first distinction I check when a result looks unexpected.

The result lies between minus half pi and half pi. A single ratio does not identify every possible direction in a coordinate system. ATAN2 addresses that limitation by taking the coordinates separately.

Convert radians to degrees

In English Excel, use DEGREES:

=DEGREES(ATAN(1))

This returns forty-five. You can express the same conversion as =ATAN(1)*180/PI(). Microsoft’s ATAN documentation shows both approaches. The Polish name of DEGREES is STOPNIE; choose names appropriate to your Excel language rather than mixing them within a formula.

English formula Result in degrees
=DEGREES(ATAN(0)) 0
=DEGREES(ATAN(1)) 45
=DEGREES(ATAN(-1)) -45

Zero and one make the examples easy to interpret. Other inputs may require an approximate display. I retain the underlying value for further calculations and choose visible decimal places for presentation. Formatting the cell does not change the unit returned by the function.

Use compatible units for a slope

Suppose a synthetic rise is two metres and the horizontal run is also two metres. The ratio is one, so =DEGREES(ATAN(2/2)) gives forty-five degrees. The division inside the function describes the slope; ATAN then finds the corresponding angle.

If one length is recorded in centimetres and the other in metres, convert them to the same unit before dividing. Excel cannot infer units from the numbers alone. A zero horizontal change makes the ratio undefined. Coordinates and ATAN2 let you handle a vertical direction without constructing that division.

Excel ATAN2 takes X before Y

The ATAN2 documentation specifies ATAN2(x_num, y_num). For a point on the positive horizontal axis:

=DEGREES(ATAN2(1,0))

X is one and Y is zero, so the angle is zero degrees. By comparison, =DEGREES(ATAN2(0,1)) gives ninety degrees because the point lies on the positive vertical axis. These examples reveal reversed arguments, unlike a point with equal coordinates.

ATAN2 preserves quadrant information. When both coordinates are minus one, the degree result is minus one hundred and thirty-five. Dividing those coordinates produces one, so ATAN of their ratio would give forty-five degrees instead. The direction information would have been lost.

Three mechanical arms point horizontally, vertically and diagonally

Boundaries and common mistakes

ATAN2 describes a point relative to the origin. For a direction between two points, first obtain the change in X and the change in Y, in that order. Do not swap them based on a convention learned in another programming language.

When both coordinates are zero, no direction can be established. Microsoft documents a division-by-zero error for ATAN2 in that case. When only X is zero and Y is nonzero, the function can represent the vertical direction without using an explicit ratio.

ATAN2 returns radians greater than minus pi and no greater than pi. Positive results describe counterclockwise angles from the positive X axis. This is a mathematical coordinate convention. I do not assume it is a geographic bearing without an additional conversion and a definition of the coordinate system.

The multi-argument formulas here use commas, typical of English regional settings. Your configuration may use another separator. Match function names and separators to your Excel language and settings while preserving the coordinate order.

Exercise: ratio or direction

Write down the degree results you expect from ATAN with zero, one and minus one. Then consider ATAN2 for points on the positive horizontal and vertical axes. Explain why swapping X and Y changes the direction.

Finally compare points with two positive coordinates and two negative coordinates. Their ratios can be identical while their directions differ. Understanding that distinction tells you when ATAN is sufficient and when ATAN2 is needed. Continue through the Excel knowledge section for related functions.

Key takeaways

What does ATAN return?

ATAN returns the arctangent of its numeric argument in radians. The input represents a tangent value rather than an angle in degrees.

How do I convert the result to degrees?

Use =DEGREES(ATAN(1)) or multiply ATAN's result by 180/PI(). An input of one corresponds to 45 degrees.

Which argument comes first in Excel ATAN2?

The X coordinate comes first, followed by Y. ATAN2 preserves quadrant information and raises an error when both coordinates are zero.

AI was used in an automated way while working on this article. If you want to learn how to do it too, check out this project.

Kajo Rudziński

Newsletter KajoData

Let’s keep in touch.

I write about data analysis, learning and changing careers. My newsletter and the sign-up form are in Polish. If that works for you, I’d be glad to see you there.