The TAN function returns the tangent of an angle measured in radians. It is a core trigonometric function used for slope, height, and angle calculations in Excel.
=TAN(number)What does TAN do?
The TAN function in Excel calculates the tangent of an angle. You give it an angle in radians, and it returns the ratio of the opposite side to the adjacent side in a right-angled triangle. This is one of Excel's built-in Math & Trig functions and works the same way as the TAN key on a scientific calculator.
Why does this matter in an office? Trigonometry is not just for maths class. If you need to work out the height of a building from a distance and an angle, calculate the slope of a roof, or model a ramp for accessibility, TAN gives you the number you need. It also pairs naturally with SIN and COS when you are building engineering or design spreadsheets.
Imagine you are estimating the height of a tree or a flagpole. You stand a known distance from the base and measure the angle from the ground to the top. The height is the distance multiplied by the tangent of that angle. With TAN in Excel, you can put the distance and angle in cells and get the height instantly, then change the angle to see how sensitive your estimate is.
When to use TAN
- Calculating the height of an object from a known distance and elevation angle.
- Working out the slope or gradient of a roof, ramp, or road.
- Solving right-triangle problems in physics, engineering, or surveying homework.
- Converting angle measurements into tangent ratios for design or CAD checks.
- Modelling periodic patterns or wave-like data in simple engineering sheets.
TAN syntax
=TAN(number)| Argument | Required? | What to enter |
|---|---|---|
number | Required | The angle in radians for which you want the tangent. If you have degrees, convert them first with RADIANS or multiply by PI()/180. Example: =TAN(RADIANS(45)) returns 1. |
What it returns: The tangent of the given angle as a number. The result can be positive, negative, zero, or a very large number near odd multiples of pi/2.
TAN examples
1 Basic tangent of a radian value
This example shows TAN working directly on radian values. Column B holds angles already in radians, and column C shows the tangent for each. The formula in the target cell simply applies TAN to the first angle. It returns the tangent of 0 radians, which is 0. This is the simplest way to see what TAN does before adding unit conversions.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Angle (radians) | Tangent | |||
| 2 | 0 | 0 | |||
| 3 | 0.785398163 | ||||
| 4 | 1.570796327 | ||||
| 5 | 3.141592654 | ||||
| 6 |
2 Tangent from degrees using RADIANS
Most people measure angles in degrees, but TAN expects radians. This table lists common angles in degrees and leaves the tangent column empty. The formula wraps the degree value in RADIANS so TAN receives the correct unit. For 45 degrees, the tangent is 1, which is a useful sanity check. The result confirms that the conversion is working.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Angle (degrees) | Tangent | |||
| 2 | 0 | 1 | |||
| 3 | 30 | ||||
| 4 | 45 | ||||
| 5 | 60 | ||||
| 6 |
3 Height of a building from distance and angle
Here TAN solves a real surveying problem. You know the horizontal distance to a building and the angle of elevation to its roof. The height is distance times the tangent of the angle. The formula converts the angle from degrees to radians and multiplies by the distance. For 50 metres and 30 degrees, the height is about 28.87 metres.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Distance (m) | Angle (degrees) | Height (m) | |||
| 2 | 50 | 30 | 28.86751346 | |||
| 3 | 75 | 25 | ||||
| 4 | 100 | 20 | ||||
| 5 |
4 Roof slope as a percentage
Builders often describe a roof by its pitch angle, but materials are ordered by slope percentage. The slope percentage is the tangent of the pitch angle times 100. This table lists several roof sections with their pitch in degrees. The formula applies TAN to the converted angle and multiplies by 100. A 30-degree pitch gives a slope of about 57.74 percent.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Section | Pitch (degrees) | Slope (%) | |||
| 2 | North wing | 30 | 57.73502692 | |||
| 3 | South wing | 35 | ||||
| 4 | Garage | 22.5 | ||||
| 5 |
5 Ramp length for accessibility compliance
Accessibility rules often limit ramp slope to a maximum ratio. If you know the rise and the maximum allowed angle, you can calculate the minimum run using rise divided by tangent of the angle. This table gives the rise in millimetres and the maximum angle in degrees. The formula computes the required horizontal run. For a 500 mm rise at 5 degrees, the run must be about 5715 mm.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Rise (mm) | Max angle (degrees) | Required run (mm) | |||
| 2 | 500 | 5 | 5715.026151 | |||
| 3 | 750 | 5 | ||||
| 4 | 1000 | 4.5 | ||||
| 5 |
Common TAN errors and how to fix them
| Error | Why it happens | How to fix it |
|---|---|---|
| #VALUE! | The number argument is text or a cell containing text instead of a number. | Check that the cell contains a numeric value. Remove spaces or quotes, or use VALUE to convert text to a number. |
| #DIV/0! | TAN is used as a divisor and the angle is exactly pi/2 or an odd multiple, where tangent is undefined. | Avoid dividing by TAN of 90 degrees or pi/2 radians. Add a check with IF to handle those angles separately. |
| Wrong sign or unexpected value | The angle was entered in degrees but TAN expects radians. | Wrap the angle in RADIANS, for example =TAN(RADIANS(45)), or multiply by PI()/180. |
| #NAME? | The function name is misspelled, such as TANN or TAN. | Use exactly =TAN(. Excel's formula autocomplete can help you pick the correct name. |
Tips for using TAN
- Always convert degrees to radians with RADIANS before using TAN, unless your data is already in radians.
- Use =TAN(PI()/4) as a quick test; it should return 1.
- Remember that tangent repeats every pi radians, so very large angles can give surprising results.
- For angles near 90 degrees, the tangent becomes very large; format the cell to show fewer decimals to keep it readable.
- Combine TAN with ROUND when you need clean output for reports, for example =ROUND(A2*TAN(RADIANS(B2)),2).
Frequently asked questions
Does Excel TAN use degrees or radians?
TAN uses radians. If your angle is in degrees, convert it first with RADIANS or multiply by PI()/180.
Why does =TAN(90) not give an error?
90 is treated as 90 radians, not 90 degrees. The tangent of 90 radians is a valid number. To get the tangent of 90 degrees, use =TAN(RADIANS(90)), which returns a very large number because tangent is undefined at exactly pi/2.
How do I calculate the tangent of an angle in degrees?
Use =TAN(RADIANS(angle)) or =TAN(angle*PI()/180). For example, =TAN(RADIANS(45)) returns 1.
Can TAN return a negative number?
Yes. Tangent is negative for angles between 90 and 180 degrees, and between 270 and 360 degrees, and so on in each cycle.
Related functions
Every example on this page was recalculated by SheetSkill’s spreadsheet engine. TAN reference