Question: how to make formula in excel vba?
Answer: Press Alt + F11. This gets you to the Visual Basic Editor, where VBA is written. ... 
Choose Insert→Module in the editor. ... 
Type this programming code, shown in the following figure: ... 
Save the function. ... 
Return to Excel.
Click the Insert Function button on the Formulas tab to display the Insert Function dialog box. ... 
Click OK.