Getting #DIV/0! in Microsoft Excel spreadsheet

The #DIV/0! error occurs when working in an Excel spreadsheet with a formula that is attempting to divide by zero. You'll get the formula result of #DIV/0! that indicates a divide by zero error. To resolve this issue, try the following recommended steps.
Do not divide by zero or non-values
The obvious solution to this issue is of course to divide only with cells with a value not equal to zero.
Use an if formula
A more elegant solution to this problem, especially when dealing with a spreadsheet that needs empty cells is to use an "if formula" like the example below.
=IF(A2="","",A2/A1)
In the example above, if cell A2 equals "" (nothing) then print nothing. Otherwise, divide the cell values A2 with A1. This example could also be modified to perform a different calculation instead of printing nothing by replacing the second "" with a formula or text.