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)| Argument | What it means | |
|---|---|---|
number | Required | The 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
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Measure | Distance (m) | Angle up (°) | |
| 2 | Office tower | 40 | 35 | 28.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
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Roof | Half span (m) | Pitch (°) | |
| 2 | Garage | 4.2 | 30 | 2.42 |
Result: 2.42
A 30° pitch over 4.2 m gives a ridge 2.42 m above the wall plate (2 decimals).
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
Wrong result | Degrees entered instead of radians. | Wrap the angle in RADIANS. |
Huge value | Angle 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.
| Language | Function name |
|---|---|
| Czech | TG |