I recently learned about the magic of the IF statement. No, not as a conditional in a programming language, but as a formula in a spreadsheet.
You know those stupid #DIV/0! errors you get after you’ve masterfully crafted a beautiful spreadsheet that doesn’t have any data in it yet?
This fixes that.
Here’s the syntax1:
=IF(CONDITIONAL, THEN, ELSE)
For example, if you want to display the results of A1 / A2 in A3, you’d use the following formula in A3:
=IF(A2=0, "n/a", A1/A2)
The second parameter (“n/a” above) can be anything you want, and is only displayed if the conditional is true.
- At least in Google Docs. ↩