# What's wrong with this Excel formula?

**URL:** https://boards.straightdope.com/t/whats-wrong-with-this-excel-formula/627025
**Category:** Factual Questions
**Created:** [July 2, 2012, 7:57pm UTC](https://boards.straightdope.com/t/whats-wrong-with-this-excel-formula/627025 "2012-07-02T19:57:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Roderick\_Femm](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/roderick_femm/32/14875_2.png) [@Roderick\_Femm](https://boards.straightdope.com/u/Roderick_Femm)
#### Post date: [July 2, 2012, 7:57pm UTC](https://boards.straightdope.com/t/whats-wrong-with-this-excel-formula/627025/1 "2012-07-02T19:57:18Z")

</div>

=if(C33=0,=if(D33\<=0,0,1),E33/C33)

If C33 = 0 then I have to worry about #div/0 error. So, if C33 = 0, then

If D33 \<= 0 then I want the result to be 0

If D33 \> 0 then I want the result to be 1

E33 is the variance.

If C33 \<\> 0 then divide E33 by C33 to get the percent variance.  
It should be equivalent to this:

If C33 = 0 then  
(if D33 \<=0 then 0  
else 1)  
else E33/C33

What am I doing wrong?  
Roddy

---

<div class="post-metadata">

### Author: ![PacifistPorcupine](https://avatars.discourse-cdn.com/v4/letter/p/7ea924/32.png) [@PacifistPorcupine](https://boards.straightdope.com/u/PacifistPorcupine)
#### Post date: [July 2, 2012, 8:00pm UTC](https://boards.straightdope.com/t/whats-wrong-with-this-excel-formula/627025/2 "2012-07-02T20:00:48Z")

</div>

Try =IF(C33=0,IF(D33\<=0,0,1),E33/C33)

---

<div class="post-metadata">

### Author: ![Roderick\_Femm](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/roderick_femm/32/14875_2.png) [@Roderick\_Femm](https://boards.straightdope.com/u/Roderick_Femm)
#### Post date: [July 2, 2012, 8:06pm UTC](https://boards.straightdope.com/t/whats-wrong-with-this-excel-formula/627025/3 "2012-07-02T20:06:40Z")

</div>

:smack:

Don’t need the 2nd = sign because it already knows it’s a formula.

:smack::smack::smack:

Thanks, **PP** for not calling me an idiot (which I probably deserve)  
Roddy
