# Divide by 0 issue in rdlc report

• ### Question

• Hi there

I have the following expression in an rdlc report. The results in this field is alwasy #Error, no matter how I change the 0 values. I have tried 0.00, I have even tried strings "0.00".

 =IIf(SUM(Fields!Bought.Value - Fields!Sold.Value) = 0, 0, SUM(Fields!SpotRate.Value * (Fields!Bought.Value - Fields!Sold.Value)) / SUM(Fields!Bought.Value - Fields!Sold.Value))

This should have a smiple solution, but I cannot see it.

Any help and suggestions are welcome.

Thanx.
It's not the blowing of the wind that determines your destination, it's the set of the sail. J Rohn
Tuesday, November 11, 2008 6:37 AM

### All replies

• Hello Excalibur7,

try this:

=IIf(SUM(Fields!Bought.Value - Fields!Sold.Value) = 0,

0,iif(SUM(Fields!Bought.Value - Fields!Sold.Value) = 0,0,

SUM(Fields!SpotRate.Value * (Fields!Bought.Value - Fields!Sold.Value)) /

SUM(Fields!Bought.Value - Fields!Sold.Value)))

BanditTreiber

Germany, NRW
Tuesday, November 11, 2008 8:10 AM
• Thanx BanditTreiber

But I still get the #Error value in the field.

It's not the blowing of the wind that determines your destination, it's the set of the sail. J Rohn
Tuesday, November 11, 2008 10:17 AM
• Marked as answer by Wednesday, November 12, 2008 5:50 AM
Tuesday, November 11, 2008 4:22 PM
• Thanx Brian

I believe that you have just saved my career and my life.

Regards.
It's not the blowing of the wind that determines your destination, it's the set of the sail. J Rohn
• Proposed as answer by Tuesday, September 6, 2011 1:27 PM
Wednesday, November 12, 2008 5:51 AM
• Me too, saved my career and my life

Thanks you

Tuesday, September 6, 2011 1:28 PM