Purpose
Return value
Syntax
=TAN(number)
- number - The angle in radians for which you want the tangent.
How to use
The TAN function returns the tangent of an angle provided in radians. For example, given the π/4 as input, the function returns 1.0 as output.
=TAN(PI()/4) // Returns 1
To supply an angle in degrees, use the radians function.
=TAN(RADIANS(45)) // Returns 1
Explanation
In math, the tangent of an angle is defined as the ratio of the opposite side to the adjacent side of a right triangle.
The definition of tangent is extended to all angles by defining the function in terms of the angle formed by a point on the unit circle.
The plot below visualizes the output of tangent for angles between -π and π. The red lines represent vertical asymptotes where the function diverges to positive and negative infinity.
Even though the function is undefined at its vertical asymptotes, Excel does not return an error for input at or near these vertical asymptotes. For example, see the following table for input around and including the location of the asymptote at the angle π/2.
This is because the tangent function is likely defined in terms of the functions sine and cosine like this:
=SIN(a)/COS(a) // equivalent to TAN(a)
It's reasonable to expect that the output of cosine for the angle π/2 should be zero, meaning you would get a division by zero error for tangent at the same input. However, Excel's formula engine calculates this value as a very small value that is close to, but not quite equal to, zero.
=COS(PI()/2) // returns 6.12323E-17 instead of zero
As a result, the tangent of π/2 does not return an error and instead returns a very large value.
=TAN(PI()/2) // returns 1.63312E+16
Images courtesy of wumbo.net.