MS Excel: How to use the TAN Function (WS, VBA)
This Excel tutorial explains how to use the Excel TAN function with syntax and examples.
Description
The Microsoft Excel TAN function returns the tangent of an angle.
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 (WS) and a VBA function (VBA) in Excel. As a worksheet function, the TAN function can be entered as part of a formula in a cell of a worksheet. As a VBA function, you can use this function in macro code that is entered through the Microsoft Visual Basic Editor.
Syntax
The syntax for the TAN function in Microsoft Excel is:
TAN( number )
Parameters or Arguments
- number
- A numeric value used to calculate the tangent of an angle.
Returns
The TAN function returns a numeric value.
Applies To
- Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Function
- Worksheet function (WS)
- VBA function (VBA)
Example (as Worksheet Function)
Let's look at some Excel TAN function examples and explore how to use the TAN function as a worksheet function in Microsoft Excel:
Based on the Excel spreadsheet above, the following TAN examples would return:
=TAN(A1) Result: -0.142546543 =TAN(A2) Result: -1.885641878 =TAN(A3) Result: 1.885641878 =TAN(2) Result: -2.185039863
Example (as VBA Function)
The TAN function can also be used in VBA code in Microsoft Excel.
Let's look at some Excel TAN function examples and explore how to use the TAN function in Excel VBA code:
Dim LNumber As Double LNumber = Tan(2)
In this example, the variable called LNumber would now contain the value of -2.185039863.
Advertisements