Math & trig function

TAN function

Returns the tangent of an angle in radians; turns an angle and a distance into a height or slope.

Available in All versions of Excel, Excel for the web, Excel for Mac

In every Excel versionWorks in Google Sheets

Syntax

TAN(number)
ArgumentWhat it means
numberRequiredThe angle in radians.

Returns: The tangent (opposite / adjacent). Can be any number.

How TAN works

The tangent is the ratio of the vertical side to the horizontal side of a right-angled triangle, which is exactly what a slope is. TAN answers "I know the angle and the horizontal distance, how high is it?": the height of a building measured from 40 m away, the rise of a roof with a 30° pitch, or the height a ramp gains over a set floor length.

TAN of an angle in degrees, multiplied by 100, is the slope as a percentage (a 45° slope is 100%). Near 90° the tangent becomes enormous because the side becomes vertical. Excel's trigonometric functions work in radians, not degrees. Convert an angle with RADIANS (or multiply by PI()/180) before passing it in, and convert results back with DEGREES.

Examples

1Height of a building from a distance

D2fx=B2*TAN(RADIANS(C2))
ABCD
1MeasureDistance (m)Angle up (°)
2Office tower403528.01

Result: 28.01

Standing 40 m away and looking up at 35°, the top is 40 × tan(35°) ≈ 28.01 m above eye level (2 decimals).

2Rise of a roof

D2fx=B2*TAN(RADIANS(C2))
ABCD
1RoofHalf span (m)Pitch (°)
2Garage4.2302.42

Result: 2.42

A 30° pitch over 4.2 m gives a ridge 2.42 m above the wall plate (2 decimals).

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 13 KB

Common errors and how to fix them

ErrorWhy it happensFix
Wrong resultDegrees entered instead of radians.Wrap the angle in RADIANS.
Huge valueAngle is (close to) 90°, where the tangent is undefined.Check the angle; vertical lines have no finite slope.

Tips

  • Slope percentage from an angle: =TAN(RADIANS(angle)), formatted as %.
  • The reverse, angle from a slope, is =DEGREES(ATAN(slope)).

Google Sheets

TAN also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

TAN in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
CzechTG