Excel formula returns #DIV/0! and how to hide it

A #DIV/0! error means the formula is dividing by zero or by an empty cell. It is common in averages, percentages, and any rate worked out before the data has arrived.

What causes it

The denominator is empty
A cell you divide by has nothing in it yet. Excel treats an empty cell as zero here, and division by zero is undefined.
The denominator really is zero
The value is a genuine zero, so the division cannot be done. This is correct behaviour, not a mistake in the formula.
An average over an empty range
AVERAGE of a range with no numbers in it divides by a count of zero, which is the same problem in disguise.

What to do

Decide what should appear when there is nothing to divide by, then wrap the formula in IFERROR: =IFERROR(A2/B2,"") leaves the cell blank, or =IFERROR(A2/B2,0) shows a zero. If you would rather see the error while building the sheet, add the guard only once the data is in.

Questions

Should I hide the error or fix the data?

If an empty denominator is expected, for example a rate before any sales, hiding it with IFERROR is the right call. If the zero is a surprise, it is worth finding out why the value is missing before covering it up.

What is the difference between IFERROR and IFNA?

IFERROR catches every error type, including #DIV/0!. IFNA catches only #N/A. For a division guard you want IFERROR.

Walkthroughs that get this right

Settings: separator, Excel version

Argument separator

Set by your computer's language, not by the file. A frequent cause of a correct-looking formula being rejected.

Excel version

XLOOKUP, IFS, TEXTBEFORE and TEXTJOIN need Microsoft 365 or 2021; older versions return #NAME? instead. Choosing the older one switches every walkthrough to a formula that works there.