Excel Tutorial

Excel TAN Function



The Excel TAN function returns trigonometric tangent of an angle (angle should be in radians).

The TAN function is a built-in function in Excel that is categorized as a Math/Trig Function. It can be used as a worksheet function and a VBA function in Excel. As a worksheet function, the TAN function can be used as part of a formula in a worksheet cell. While as a VBA function, this function can be used in a Excel macro code. The Excel macro code can be created using the Microsoft Visual Basic Editor.

Syntax

TAN(number)

Parameters

number Required. Specify the angle in radian.

Return Value

Returns the trigonometric tangent of an angle.

Notes

  • If the argument is in degrees, multiply it by PI()/180 or use the RADIANS function to convert it to radians.
  • If the argument is a non-numeric value, TAN returns #VALUE! error.
  • If the argument is outside its constraints, TAN returns #NUM! error.

Example: Using as Worksheet Function

The example below shows how to use the TAN function as worksheet function.

Excel TAN function

Based on the Excel spreadsheet above, the output of the following worksheet formula will be:

=TAN(C5)
Result: 0

=TAN(C6)
Result: 1

=TAN(C7)
Result: 16324552277619100

=TAN(C8)
Result: -1

=TAN(C9)
Result: 0

=TAN(C10)
Result: 1

=TAN(C11)
Result: 5441517425873020

=TAN(C12)
Result: -1

=TAN(C13)
Result: 0

Example: Using angles in Degrees

To supply an angle to TAN function in degrees, the angle can be multiplied by PI()/180. Alternatively, the angle expressed in degrees can be used in the TAN function by converting it into radians using RADIANS function. For example, to get the TAN of 45 degrees, the following formula can be used:

=TAN(45 * PI()/180)
Result: 1

=TAN(RADIANS(45))
Result: 1

Example: Using as VBA Function

The TAN function can also be used in VBA code in Microsoft Excel. Consider the example below:

Dim FValue As Double

FValue = Tan(1)

In this example, the variable called FValue will contain the value of 1.5574077246549.


❮ Excel Functions