Formulas
Formulas are the most important function of Excel. Formulas enable users to add, subtract, multiply, divide, and interact with data on endless levels.
The most important part of formulas in VBA, besides knowing the formula of course, is being able to place the formula properly in the data set. Correct placement of formulas will enable you to customize your calculations regardless of how the data set changes on a daily basis.
Basic formulas
'The below code adds cells A1 to B1
=a1+b1
'The below code subtracts cells B1 from A1
=a1-b1
The purpose of the below video is not to teach you the different formulas in excel. You can read about them on your own. If you want a list of all the formulas in Excel, just click the below on your Excel workbook:
Clicking on the above will bring up the below. You can switch between financial formulas, date formulas, time formulas, logical formulas, etc.:
The below 1,2, and 3 represent the arguments of an IF formula.
=if(argument1, argument2, argument3)
=if(a1=1,1,0)
If a1 does equal 1, then this formula will return 1 in the cell that contains this formula function.
If a1 does NOT equal 1, then this formula will return 0 in the cell that contains this formula function.
Argument 1 is the logical test such as if(a1=1. Argument 2 is what is returned if the IF formula is true. Argument 3 is what is returned from the IF formula if the condition is false.
You can mix and match whatever you formulas you need using the below video guide to customize your workbook to perform any manual calculation automatically without human error.