I have a pretty simple formula in several columns of a grid that I am exporting to Excel. it's Average Dollars Per Sale (Net Sales$/# of Sales Transactions). Originally I actually populated each cell with the actual number, but I wanted to use a formula instead so that they can subtotal the average properly in Excel.
Problem is, where there's no data, I am getting a divide by zero error. Ugly, but I wouldn't care if it didn't screw up subtotaling, but it does.
I need some way of NOT putting the formula in a cell (or overwriting it with nulls) when the result of that formula is going to be a problem.
Problem is, it appears that your formulas work at the Column, not cell level via the InitializeLayout event.
Is there any way to make this 'smarter', or to massage 'problem cells' after the fact?
Thanks.
I see you can do this in Excel:
=IF(denominator=0,"",numerator/denominator)
Is this possible within the grid formula? And if so, what would the syntax be?
Found the answer here: http://es.infragistics.com/community/forums/p/64060/324374.aspx#324374
e.Layout.Bands[0].Columns["int1"].Formula = "if( [int]=0 , 0 , 100/[int] )";