# IF ELSE condition formula - BEx query designer

Hello guys,

I have 3 columns - C1, C2 and ( C1 %A C2 ).

In C1 % C2, i have to write a formula.

If ( C2 = 0 ) THEN ( C1 * 100 ) ELSEIF (C2 NE 0 ) THEN ( C1 %A C2 ).

The formula I wrote does not seem to be working. I am using this formula in cell reference

(C2 == 0) * C1 * 100 + (C2 <> 0) * C1 %A C2.

This is not working.

When I use this formula in the cell reference, then the result is still 'X' (i.e. undefined)

If I use only this:

(C2 == 0) * C1 * 100

Then the formula works fine (eg. if C1 = 2, C2 = 0 result is 200%).

I tried to use 'OR' instead of '+' in the formula. Nothing seems to work.

Please advise.

Thanks

##### Former Member replied

Try this, (C2 == 0) * C1 * 100 + NDIV0(C1 %A C2) * (C2 <> 0)

If not then try this, (C2 == 0) * C1 * 100 + NDIV0(C1 %A C2) * (C2 > 0) + NDIV0(C1 %A C2) * (C2 < 0)

Cheers,

Neel.

Edited by: Neelesh Jain on Sep 17, 2009 11:56 AM

Edited by: Neelesh Jain on Sep 17, 2009 12:01 PM