Summary

The Excel TAN function returns the tangent of the angle given in radians. To supply an angle to TAN in degrees, multiply the angle by PI()/180 or use the RADIANS function to convert to radians.

Purpose 

Get the tangent of an angle

Return value 

The tangent 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.

Tangent function definition.

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.

Tangent function unit circle definition.

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.

Plot of the tangent function with asymptotes.

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.

Tangent function output at vertical asymptote.

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.

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.