Creating a Custom Excel Function
Though macros are an advanced topic, here's a
good place to start
by Mark Henri
Use the macro editor to create a custom function. Here's how--
- Create a new Excel spreadsheet, name it and save it. Or you can
open an existing spreadsheet.
- Choose Tools > Macros > Visual Basic Editor
- In the projects window, choose 'ThisWorkbook'.
- If you don't see a blank work area to the right, choose Insert > Module.
- Type in the following formula--
function VanityAge(a)
VanityAge = a - 5
end function
- Switch back to the Excel window (Alt + Tab)
- Save the spreadsheet
- Type the following into cell A1 and press enter when done--
=VanityAge(44)
- Hopefully you see the number 39 in the cell
- Put the value 50 in A3
- In cell A2, enter the following and press enter--
=VanityAge(A3)
- A2 should now contain 45.
Click here to see an example workbook.
Send comments or concerns to