Avoiding Divide-by_Zero in Field Calculator in Model Builder

Discussion created by eladmo on Aug 24, 2012
Latest reply on Aug 24, 2012 by curtvprice
I'm having a problem when using the tool Calculate Field in Model Builder:
My calculation formula is [pop_per_pixel] = [POP_2010] / [RES_PIX] * [proportion].
Since some of the features have [RES_PIX]=0, the model stops and indicates an error. I tried to select only those features that aren't equal to zero, but the tool 'Select Layer By Attribute' could not be integrated in the model chain.
Is there a VB code I can put in the Code Block window?
What would be the Python code for that?
How else would you overcome this issue?