Article ID: 214260 - Last Review: June 23, 2005 - Revision: 4.0 HOW TO: Create Functions to Calculate Light Years in Excel 2000This article was previously published under Q214260 On This PageSUMMARY
This step-by-step article shows you how to create functions in Excel 2000 to calculate light years.
Microsoft Excel does not include a function that converts miles into light years or light years into miles. This article explains how to create custom functions to make these calculations. Example CalculationsThe following formulas give the conversion rate between miles and light yearsMiles to Light Years = M / 5,877,000,000,000 Light Years to Miles = LY * 5,877,000,000,000 where M is the number of miles and LY is the number of light years. Suppose that you want to calculate the number of miles between the earth and the closest star system, Alpha Centauri. Alpha Centauri is 4.3 light years away. If you type the following formula into a cell on a worksheet, including the information about Alpha Centauri shown earlier in this article, the formula returns a total of 25,271,100,000,000 miles: =4.3*5,877,000,000,000 Create a Function MacroMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To create this function with Microsoft Visual Basic for Applications, type the following in a new Visual Basic module:Use the Custom FunctionTo use the custom function, follow these steps:
REFERENCESFor more information about writing function procedures, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type writing a Function Procedure in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
| Article Translations
|
Back to the top
