TAN

Math & Trigonometry Functions
(4.8/5)

Returns the tangent of an angle given in radians. Essential for trigonometry, engineering calculations, and mathematical analysis. Tangent values can be any real number and become undefined at 90° and 270° (±π/2).

Interactive Formula Tester

=TAN("0.785")

Complete Theory & Understanding

Master the fundamentals of Excel TAN function

Core Concept

The TAN function returns the tangent of an angle given in radians. Tangent is defined as the ratio of sine to cosine: tan(θ) = sin(θ)/cos(θ). TAN can return any real number and is undefined at 90° and 270° (±π/2 radians). Essential for trigonometry, engineering calculations, and mathematical analysis.

Why Use TAN?

  • Solve triangle problems and angle calculations
  • Calculate slopes, angles, and forces
  • Perform mathematical calculations and analysis
  • Perform scientific computations

Key Characteristics

Requires Radians

Input angle must be in radians

TAN(RADIANS(45)) = 1

Any Real Number

Output can be any real number

TAN(any_angle) = any real number

Periodic Function

Repeats every π radians (180°)

TAN(angle) = TAN(angle + π)

Undefined at ±π/2

Undefined at 90° and 270°

TAN(RADIANS(90)) = undefined

Function Anatomy

=TAN(parameters...)
Required
Parameters:

Function-specific parameters

Returns
Return Value:

Function-specific return type

Primary Use Cases

Trigonometry

Solve triangle problems and angle calculations

Engineering

Calculate slopes, angles, and forces

Mathematical Analysis

Perform mathematical calculations and analysis

Scientific Calculations

Perform scientific computations

Theory Summary

Precise

Exact matching required

Position-Based

Returns numeric position

Error-Safe

Handles missing text gracefully

Syntax & Parameters

=TAN(number)
Required
number:

The angle in radians for which you want the tangent. If angle is in degrees, use RADIANS() to convert first.

Returns
Return Value:

The tangent of the angle (can be any real number)

Description: Returns the tangent of an angle given in radians

Interactive Examples

Basic TAN

Calculate tangent of angle

"0 radians"
=TAN(0)
0

Returns 0 because tan(0°) = 0. TAN(0) = tan(0 radians) = tan(0°) = 0.

VBA Implementation & Automation

Basic TAN in VBA

Use TAN function in VBA

' Basic TAN in VBA
Range("C1").Value = Application.WorksheetFunction.Tan(Application.WorksheetFunction.Radians(45))
' Returns: 1

' Calculate tangent of angle in degrees
Sub CalculateTangent()
    Dim angleDegrees As Double
    angleDegrees = Range("A1").Value
    Dim angleRadians As Double
    Dim tangent As Double
    angleRadians = Application.WorksheetFunction.Radians(angleDegrees)
    tangent = Application.WorksheetFunction.Tan(angleRadians)
    Range("B1").Value = tangent
End Sub

' Calculate opposite side in triangle
Sub TriangleOpposite()
    Dim angleDegrees As Double, adjacent As Double
    angleDegrees = Range("A1").Value
    adjacent = Range("B1").Value
    Dim opposite As Double
    opposite = Application.WorksheetFunction.Tan( _
        Application.WorksheetFunction.Radians(angleDegrees)) * adjacent
    Range("C1").Value = opposite
End Sub

' Handle undefined values
Sub SafeTAN()
    Dim angleDegrees As Double
    angleDegrees = Range("A1").Value
    If angleDegrees = 90 Or angleDegrees = 270 Then
        Range("B1").Value = "Undefined"
    Else
        Range("B1").Value = Application.WorksheetFunction.Tan( _
            Application.WorksheetFunction.Radians(angleDegrees))
    End If
End Sub

Business Applications

Triangle Calculations

Calculate opposite side in right triangle

=TAN(RADIANS(angle)) * adjacent

Slope Calculations

Calculate slope from angle

=TAN(RADIANS(angle))

Engineering Problems

Calculate angles and forces in engineering

=TAN(RADIANS(angle))

Mathematical Analysis

Perform mathematical calculations

=TAN(RADIANS(angle))

Common Issues & Solutions

Degrees Not Working

TAN returns unexpected value with degrees

=TAN(RADIANS(45)) not =TAN(45)

Solution: TAN requires radians, not degrees. Always convert: TAN(RADIANS(degrees)). TAN(45) is not tan(45°), it's tan(45 radians).

Undefined Values

TAN returns error or very large number at 90°

=IF(OR(A1=90, A1=270), "Undefined", TAN(RADIANS(A1)))

Solution: TAN is undefined at 90° and 270° (±π/2). Use IF to handle: IF(OR(angle=90, angle=270), "Undefined", TAN(RADIANS(angle))).

Very Large Results

TAN returns very large numbers near 90°

Check angle: IF(ABS(angle-90)<0.001, "Near undefined", TAN(RADIANS(angle)))

Solution: This is expected behavior - TAN approaches infinity at 90°. Check if angle is exactly 90° or very close. Handle with conditional logic.

Precision Issues

TAN results have unexpected precision

=ROUND(TAN(RADIANS(45)), 4)

Solution: Use ROUND for display: ROUND(TAN(RADIANS(angle)), digits). TAN can return very large numbers that need formatting.

Inverse Relationship

Uncertainty about TAN vs ATAN relationship

TAN(ATAN(1)) = 1

Solution: TAN is inverse of ATAN: TAN(ATAN(value)) = value. ATAN(TAN(angle)) = angle (in radians, within -π/2 to π/2).

Performance Tips & Best Practices

⚡ Performance Optimization

  • TAN is very fast - minimal performance impact
  • Convert degrees to radians once, reuse if needed
  • Round results only for display, not in calculations
  • TAN works efficiently in array formulas
  • For large datasets, pre-calculate RADIANS() in separate column

🎯 Best Practices

  • Always use TAN(RADIANS(degrees)) for angles in degrees
  • Remember TAN requires radians input
  • Handle undefined values at 90° and 270°
  • Common values: tan(0°)=0, tan(45°)=1, tan(60°)=√3≈1.732
  • Test with known values to verify correctness
  • Document whether angles are in degrees or radians
  • Combine with SIN, COS for complex trigonometric calculations
  • Be aware TAN can return very large numbers near 90°