- 10-2 = 8
- 8-2 = 6
- 6-2 = 4
- 4-2 = 2
- 2-2 = 0
So, 10/2 = 5.
- 10-0 = 10
- 10-0 = 10
- 10-0 = 10
- 10-0 = 10
…..Infinity
=IF(C4=0, 0, D4/C4)
Image 2-9: Using the IF function to avoid a division-by-zero error. |
How it works
The IF function requires three arguments: the condition; what to do if the condition is true; and what to do if the condition is false.
The condition argument in this example is the budget in C4 is equal to zero (C4=0). Condition arguments must be structured to return TRUE or FALSE, and that usually means that there is a comparison operation (like an equal sign or greater-than sign).
If the condition argument returns TRUE, the second argument of the IF function is returned to the cell. The second argument is 0, meaning that you simply want a zero displayed if the budget number in cell C4 is a zero.
IF the condition argument is not zero, the third argument takes effect. In the third argument, you tell Excel to perform the division calculation (D4/C4). So this formula basically says that if C4 equals 0, then return a 0, or else return the result of D4/C4.
0 komentar:
Post a Comment