I am attempting to create a custom function using other functions in
EXCEL. I am attempting to take an array of data (range of cells)
perform a few calculations and return the results. The function will be
stored in the appropriate workbook.
Here is the Code
Function AvgWndDir(cellrange)
Radianz = WorksheetFunction.Radians(cellrange)
' Convert from degrees to Radians
SINZ = WorksheetFunction.Sin(Radianz)
' Take the SIN of the Radians
AVGS = WorksheetFunction.Average(SINZ)
'Average the Sines
INVSIN = WorksheetFunction.Asin(AVGS)
' Take the inverse SIN of Average
DEG = WorksheetFunction.Degrees(INVSIN)
' Convert back to degrees from Radians
ROUNDED = WorksheetFunction.MROUND(DEG, 5)
' Round to nearest five degrees
End Function
Any help would be greatly appreciated. :(
--
rexmorgan
------------------------------------------------------------------------
rexmorgan's Profile:
http://www.excelforum.com/member.php...o&userid=28167
View this thread:
http://www.excelforum.com/showthread...hreadid=476925