Astra

Excel VBA ASin (ArcSine or Inverse Sine) Function (2 Examples)

Estimated reading: 4 minutes

While working with a trigonometrical function, you may need to know how to find the inverse value of Sine. In Excel’s basic feature, we have the ASIN function. But to apply this in VBA, a dedicated worksheet function is named the Asin function. 

Find Inverse Sine Values by VBA Asin Function
Find Inverse Sine Values by VBA Asin Function

Purpose of the VBA ASin Function

To find the angle in radians for a given sine value.

Syntax of the VBA ASin Function

WorksheetFunction.Asin(Arg 1 As Double)
Syntax of the VBA Asin Function
Syntax of the VBA Asin Function

Arguments of the VBA ASin Function

ArgumentExplanation
Arg 1 As DoubleThe number for which the angle will be calculated.

Example #1: Get Radian Angle for Value with Excel VBA ASin Function 

  • Copy the following code to get the angle value in radians.
Sub Asin_Radian()
Dim xCell As Range
'Apply For Loop with ASin Function
For Each xCell In Range("B4:B8")
  xCell.Offset(0, 1) = WorksheetFunction.Asin(xCell.Value)
Next xCell
End Sub
VBA Asin Function to Find Inverse Sine Values in Radian
VBA Asin Function to Find Inverse Sine Values in Radian
  • Your output will be figured out in the image below. 
Return Values with VBA Asin Function
Return Values with VBA Asin Function

Example #2: Get Degree Angle for Value with Excel VBA ASin Function

Now, to get values in degrees, copy the following codes and apply them to your Module.

Sub Asin_Degree()
Dim Pi As Long
Dim xCell As Range
Dim xCellValue As Range
Dim Asin_Degree As Range
'Apply For Loop with Asin function
For Each xCell In Range("B4:B8")
   xCell.Offset(0, 1) = WorksheetFunction.Asin(xCell.Value)
Next xCell

Pi = 3.14159265358979

Set xCellValue = Range("C4:C8")

For Each xCellValue In Range("C4:C8")
'Offset function for (0, 1) value will place the result in the next column
    xCellValue.Offset(0, 1) = (xCellValue * 180) / 3.14159265358979
Next xCellValue

End Sub
VBA Asin Function to Find Inverse Sine Values in Degree
VBA Asin Function to Find Inverse Sine Values in Degree
  • So, the output will be similar to the image below. We have calculated the radian angles in column C and in the D column we have calculated the degree value for the sine values in range B4:B8.
Return Values by VBA Asin Function
Return Values by VBA Asin Function

Things to Keep in Mind

  • The Asin function requires as its input a numeric expression representing an angle’s sine in radians with a range of values between -1 and 1, inclusive. The function will return a run-time error if the input is outside of this range.
  • The Asin function returns a radian value as its output. The Application.WorksheetFunction.Degrees method can be used to translate the result into degrees.
  • While working with degrees, you can convert them to radians using the Application.WorksheetFunction.Radians method before inputting the angle to the Asin function.

Frequently Asked Questions

A: What distinguishes the Asin and Acos functions? 

A: The Asin function returns the arcsine of a given angle in radians, while the Acos function returns the arccosine of a given angle in radians. They are inverse trigonometric functions of each other.

Q: Are there any additional trigonometric functions in VBA?

A: The functions for computing the sine (Sin), cosine (Cos), tangent (Tan), arctangent (Atan), and hyperbolic sine, cosine, and tangent (Sinh, Cosh, and Tanh) are all available in VBA.

Conclusion

The VBA Asin 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! 

2 thoughts on “Excel VBA ASin (ArcSine or Inverse Sine) Function (2 Examples)”

  1. I?¦ve been exploring for a bit for any high quality articles or weblog posts on this sort of area . Exploring in Yahoo I eventually stumbled upon this website. Reading this info So i?¦m glad to express that I have an incredibly good uncanny feeling I came upon exactly what I needed. I such a lot certainly will make certain to do not omit this site and provides it a look regularly.

Leave a Reply

Your email address will not be published. Required fields are marked *

Share this Doc
Jump to Topics
SOLVED EXCEL
Scroll to Top