User-defined functions in Excel
Excel lets you create your own functions. If you wanted to create a function that returned the distance between two points (x1,y1) and (x2,y2), you can create a function DIST that takes these 4 parameters, and use it as shown below. To create such a function, press Alt-F11 to open the Visual Basic Editor insert a new module (Alt-I-M) type the following code: ...