Inverse Sine calculation with formualr1c1 function

bradyj7

Board Regular
Joined
Mar 2, 2011
Messages
106
Hi there,

I want to find the inverse sine (sin^-1) of numbers in a column to get a column of angles next to it. I cant figure it out. This is what I have so far. The values are in the previous column.
Code:
    Range("m1").Value = "Angle of road"
    Range("m2").Value = 0
    Range("m3:m" & LastRow).FormulaR1C1 = "=Atn( rc[-1] / Sqr(rc[-1] * rc[-1] + 1))"

I got the inverse sine function from this page http://www.vbforums.com/showthread.php?t=161043

When I compile it, there is no error but this #NAME? is returned in the cells

Thank you
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
There is no ATN function. Are you trying to use ATAN? Same for SQR .... SQRT maybe?
 
Upvote 0
To be honest I don't know what ATN is, I just took it form the link above. Would you know how to calculate the inverse sine of a number in vba.
 
Upvote 0
Why don't you just use the ASIN worksheet function?
 
Upvote 0
Do you mean this
Code:
Range("m1").Value = "Angle of road"
    Range("m2").Value = 0
    Range("m3:m" & LastRow).FormulaR1C1 = "=ASIN (rc[-1])"

I tried this but it just returns the value in the previous cell?

Thank you
 
Upvote 0
What values are in your cells? Show the first few values in column M.
 
Upvote 0
Your values are all very closr yo zero, that's what I'd expect as the results. See some more examples here:
Excel Workbook
AB
80.60.643501
9-0.823-0.96667
100.921.16808
110.951.253236
120.9951.470755
Sheet12


What exactly were you expecting for those values anyway?
 
Upvote 0
Oh I think your right. I'm working in degrees not radians. So when I was doing sin-1(0.6) on my calculator (which is in degrees) was getting 36.87 degrees as the angle. But sin-1(0.6) in radians is 0.6435 as above. I just need to convert degrees to rads.

Cheers
 
Upvote 0
Do you mean this
Code:
Range("m1").Value = "Angle of road"
    Range("m2").Value = 0
    Range("m3:m" & LastRow).FormulaR1C1 = "=ASIN (rc[-1])"

I tried this but it just returns the value in the previous cell?

Thank you

Hi bradyj7

Please notice that for very small values of x, sin(x) and asin(x) are approximately equal to x.

For ex., for your first value, if you are showing in the cell 3 decimals, asin(0,04) will display 0,04

If you try a bigger vakue, for ex. 0.4 you'll see the result 0.412. Here, since it's a bigger value you can already see the difference.

For the values you posted, {0.039999999, -0.023441861, 0.025200002, 0.022941175}, they are close to zero and so expect asin() to show a value close to the argument. If you are displaying 3 decimals you'll see no difference in the argument and the result of the function.
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,317
Members
452,905
Latest member
deadwings

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top