Hi @Jannette Jones ,
Please try:
=IIF((Fields!mnyGPITotal.Value = 0 or Fields!mnyGPITotal.Value is nothing), "", Fields!Varriance.value/IIF(Fields!mnyGPITotal.Value = 0 or Fields!mnyGPITotal.Value is nothing, 1,( Fields!mnyGPITotal.Value)))
Or:
=IIF((Fields!mnyGPITotal.Value = 0), "", Fields!Varriance.value/IIF(Fields!mnyGPITotal.Value = 0, 1,( Fields!mnyGPITotal.Value)))
Or you can add a function in your custom code to handle division by zero:
Public Function Divider (ByVal Dividend As Double, ByVal Divisor As Double)
If Is Nothing(Divisor) Or Divisor = 0
Return 0
Else
Return Dividend/Divisor
End If
End Function
then call it in a cell like this:
=Code.Divider(Fields!FieldA.Value, Fields!FieldB.Value)
Best Regards,
Joy
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.