Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
508
Conditional formula for column
posted

I am having grid columns with formula basing on other columns but the catch is the formula should change based on the value entered in the cell. Example: Grid with Columns A,B,C where the formula for C is defined as C = [ A ]*[ B ]*2 for normal values. This formula should change as C = [ A ]/2 * [ B ]*2 when value entered in cells of columnA is <0.9

How can achieve this conditional formula using the formula property?

 

  • 508
    Verified Answer
    posted

    Hey,I found the solution for that. There are whole bunch of functions available for setting the formulas to a column in the designer mode and in the logical functions tab, we have the if condition using which we can specify the conditional formula.

    This is pretty exciting. I have set the formula for the above scenario as :

    Formula="if( [ A ]<0.9 , [ A ]/2*[ B ] * 2 , [ A ]*[ B ]*2 )"

    The only hitch is that if you are using the designer for creating the formula, all the "<" become &lt;..Just be careful with that. Rest all is taken care by lovely webgrid.