The difference between SkipVought's code and the one you used is,
The one that worked for you assumes a Default value of 0, if nothing is passed as an argument or a Null Value is passed.
So having G1=0 obviously will give you an infinite value for the following operation,
If (A1 / G1 > 2). You...