**COS Function (Table of Content)**

## Excel COS Function

Cos function in excel is a mathematical function that calculates the Cos value of any angle. As we know Cos angle is the ratio of Base to Hypotenuse, but in excel we need to select radians function here along with COS Function to get the proper angle value. Also, we can multiply the input angel value with Pi()/180 other than using the Radians function.

It comes under head Formulas and the Math & Trig. The screenshot is given below:

We can see in the above pic that the COS is the formula for trigonometry in Mathematics. This function is built of MS Excel. The function of the COS is that it returns the cosine of a given angle in radians. We can calculate the angle by using the RADIANS function or we can multiply it by PI()/180. It can be used as a worksheet function (WS) and VBA function, as well as in Microsoft Excel. If we are using it in worksheet function, then we can enter the formula in a cell of a worksheet and if we are using it through VBA then it should be entered as macro code in Microsoft Visual Basic Editor.

**COS Formula in Excel:**

Below is the COS Formula.

This formula has one argument which is number and it is the mandatory parameter.

**Number:** this is the which shows the angle for which the calculation of cosine is going to occur.

We can also use this formula just entering into one cell as =COS(number) in Microsoft Excel.

### How COS Function Works?

As we know, Trigonometry is a branch of Mathematics in which we study about the relations between the elements of a triangle which is as sides and angles. Microsoft Excel has lots of Trigonometry function which is inbuilt, to help complex problems of the same. The user has to keep in mind while solving or using these function that Microsoft Excel performs the result or calculation considering angle value in radians but not in degrees, which makes the process different from doing it manually.

For example, we know that COS 30 = 0.866 but when we enter directly it will give the result as 0.154 so, first we have to convert in radians and then calculate the COS on radians.

### How to Use the COS Function in Excel?

This COS Function is very easy to use. Let us now see how to use the COS function in Excel with the help of some examples.

#### Example #1

As we discussed, first we need to calculate the Radians for the given angle and then we will calculate the COS.

**Step 1:** First, we will take the raw data for which COS needs to be calculated. Below is the picture:

**Step 2: **Now we have to click on Formulas and under that Math & Trig. We can see this step in below pic:

So, we can see that there are lots of functions listed in this category.

**Step 3: **Now we have to go on option Radian and click it. We can see this step in below pic:

**Step 4: **Now we have to select B4 as an angle to achieve the result and then click Enter. Please refer below pic:

After pressing Enter, the result will be shown like below:

**Step 5: **Now we can drag the formula to each degree like shown in the below screenshot.

So, we have the Radians ready, now we have to calculate the COS for these Radians.

**Step 6: **We have to repeat step 1 & step 2 and select the COS option. Below is the picture for reference.

**Step 7: **Now we have to click on COS, select the C4 and press Enter or click OK.

After clicking OK we have below result:

**Step 8: **We can drag the formula for D5 to D8 and we will have the result.

So, we have the results ready. We understood from the above step that firstly RADIANS need to be calculated before calculating COS. After calculating RADIANS, we have to calculate the COS on that RADIANS and it will give the desired result which will be COSINE for each angle.

#### Example #2

As we discussed earlier, we can use it in the VBA code as well in Microsoft Excel. So, below is one of the codings to use COS function as a VBA code.

Dim LNumber As Double

LNumber = COS(5)

The Lnumber above is 0.523598776, which is as a variable.

#### Example #3

We will see in VBA to apply on degree 30.

So, below is the solution:

Dim val As Double

‘Convert 30 degrees to RADIANS by multiplying by PI/180.

Val = COS(30*PI/180)

‘The variable value is now equal to 0.86602.

So, in the above formula, angle 30 is converted into radians first and then COS.

### Things to Remember

- If the angle is given in degrees for which we have to calculate COS then firstly we have to calculate RADIANS for the same or we can multiply the angle by PI()/180.
- COS always uses the parameter as RADIANS.

### Recommended Articles

This has been a guide to COS Function. Here we discuss the COS Formula and how to use COS function along with practical examples and downloadable excel templates. You can also go through our other suggested articles –