# Excel VBA Acos Function (ArcCos or Inverse Cos) (3 Examples)

The **Acos **function in Visual Basic for Applications (**VBA**) calculates the arccosine (inverse cosine) of a given angle in radians. The cosine of the angle is the only argument required for the **Acos **function, which then returns a value in radians between 0 and pi.

**Purpose of the VBA Acos Function**

To find the radian angle of a cosine value.

**Syntax of the VBA Acos Function**

`WorkSheetFunction.Acos(Arg1 As Double)`

**Arguments of the VBA Acos Function**

Argument | Explanation |

Arg1 As Double | The cosine value for which the radian angle is calculated |

**Example #1: Get Radian Angles with the VBA Acos Function**

The **VBA Acos** function by default calculates the arccosine or inverse cosine values in radians. But, this function cannot perform for a range of values. So, we will apply a **For Loop **with the **VBA Acos **function to apply the function to each cell in a range.

- Copy the codes and paste them into your Module.

```
Sub Acos_Radian()
Dim xCell As Range
'Apply For Loop with Acos Function
For Each xCell In Range("B4:B8")
Â Â xCell.Offset(0, 1) = WorksheetFunction.Acos(xCell.Value)
Next xCell
End Sub
```

- After running the code, you will get the following output with the radian values for the
**Acos**function.

**Example #2: Get Degree Angles with VBA Acos & Pi Functions**

The **VBA Acos** function does not return the values in degrees. To get the degree angles, we will apply the general formula for degree conversion.

`degree = (radian*180) / Pi) 'Pi = 3.14159265358979`

- Copy the codes and paste them into your Module.

```
Sub Acos_Degree1()
Dim Pi As Long
Dim xCell As Range
Dim xCellValue As Range
Dim Acos_Degree As Range
'Apply For Loop with Acos function
For Each xCell In Range("B4:B8")
Â Â Â xCell.Offset(0, 1) = WorksheetFunction.Acos(xCell.Value)
Next xCell
Pi = 3.14159265358979
Set xCellValue = Range("C4:C8")
For Each xCellValue In Range("C4:C8")
'Offset function for (0, 0) value will place the result in the same column
Â Â Â Â xCellValue.Offset(0, 0) = (xCellValue * 180) / 3.14159265358979
Next xCellValue
End Sub
```

- After running the code, you will get the following output values in degrees.

**Example #3: Get Degree Angles with VBA’s Acos Function & WorkSheetFunction.Degrees Function**

Similar to **Example 2**, we will apply the **VBA Degrees** function to get the inverse cosine values in degrees. The **VBA Degrees **function is a built-in **WorkSheetFunction **to convert radians into degrees.

- Copy the codes and paste them into your Module.

```
Sub Acos_Degree2()
Dim xCell As Range
Dim xCellValue As Range
Dim Acos_Degree As Range
'Apply For Loop with Acos function
For Each xCell In Range("B4:B8")
Â Â Â xCell.Offset(0, 1) = WorksheetFunction.Acos(xCell.Value)
Next xCell
Set xCellValue = Range("C4:C8")
For Each xCellValue In Range("C4:C8")
'Offset function for (0, 0) value will place the result in the same column
Â Â Â Â xCellValue.Offset(0, 0) = Application.WorksheetFunction.Degrees(xCellValue.Value)
Next xCellValue
End Sub
```

- After running the code, you will get the following output values in degrees.

**Things to Keep in Mind**

- The function returns a radian value in the range of 0 and pi.
- For some input values, such as those outside the cosine argument’s range of -1 to 1, the
**Acos**function may return errors. - It is a built-in feature of VBA and doesn’t call for the importation of any extra libraries or modules.

**Frequently Asked Questions**

**Q1: What occurs if the Acos function’s input value falls outside of the range of -1 to 1?**

- The
**Acos**function will return a**#NUM! Error**if the input value is outside the range of -1 to 1.

**Q2: Can the Acos function produce negative results?**

- The answer is that the
**Acos**function can produce negative values, which correspond to angles in the third or fourth quadrant of the unit circle.

**Q3: Is the Acos function case-sensitive?**

- No, the
**Acos**function is not case-sensitive in VBA, so you can use either uppercase or lowercase letters to call it.

**Conclusion**

The VBA **Acos **function is useful in a variety of mathematical and scientific applications, such as calculating angles in trigonometry or calculating probabilities in statistics. These, in our opinion, will improve your professional work life somehow. If you have any additional questions, kindly post them in the comment section below. You will answer by offering solutions from the **Solved Excel** research department. Stay safe and get connected with us!

https://Sites.Google.com/view/gambling-gamingindustryGreat weblog right here! Also your site so much up very fast!

What host are you the usage of? Can I am getting your associate link to

your host? I wish my site loaded upp as quickly as yours lol

my blog: https://Sites.Google.com/view/gambling-gamingindustry

https://vavadacasino.mystrikingly.com/What i don’t realize is in trith how you are

now not really a lot more well-preferred than you

might bee right now. You aree so intelligent.

You know therefore considerably with regards to this matter, produced me

in my opinion believe it from a lot of varied angles. Its lik

women and men are not involved unlkess it iis one thing to do with Woman gaga!

Your personal stuffs great. Always handle it up!

my blog post https://vavadacasino.mystrikingly.com/

MellisaI bblog often and I seriousl thank youu for your content.

The article haas truly peaked my interest. I am going to bookmark your site and keep chewcking for

new details about once per week. I opted in for yolur RSS feed too.

Here is my web-site … Mellisa