Go to Insert Menu and select module. Heres the completed code. We have a great community of people providing Excel help here but the hosting costs are enormous.
If youre working on automating that process with a macro then you can have VBA write the formula and input it into the cells for you.
After that use an equal sign and type ApplicationWorksheetFunction as you can already in the Excel application you can only use WorksheetFunction. Using worksheet functions saves you time over writing your own functions in VBA. We have seen that we can use the worksheet functions in VBA ie. This is a tutorial about writing code in Excel spreadsheets using Visual Basic for Applications VBA.