Focal Point
[SOLVED] EXL2K FORMULA question

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3877093006

March 16, 2011, 01:30 PM
j.gross
[SOLVED] EXL2K FORMULA question
I am looking for a way to make WebFOCUS gnerate an Excel formula equivalent to the fex code

COMPUTE INDICATOR/I4=IF X EQ 0 THEN 0 ELSE 1;


Of course, Excel has an IF(,,) function which could be used for that purpose:

=IF( [cel reference] =0, 0, 1)


But WF (as of 7.7.02) apparently lacks the smarts to translate an IF THEN ELSE to =IF( , , ).


If X were known to be non-negative, I could use

COMPUTE INDICATOR/I4= X / MAX(X,0.0000000001);


That will yield 1 when X ge 0.0000000001, and 0 when X eq 0 (while avoiding a zero division error)

But in the present case X is user-modifiable, and unrestricted in sign, in the spreadsheet.

Any suggestions?

This message has been edited. Last edited by: j.gross,
March 16, 2011, 01:41 PM
j.gross
I think this will do it:

COMPUTE INDICATOR/I4= 
MAX( X / MAX(X,0.0000000001),X / MIN(X,-0.0000000001) );


should translate directly to a similar-looking Excel formula,
and gives
for x =0 : max(0,0) = 0
for x >0 : max( 1, a negative value ) = 1
for x <0 : max[ a negative value, 1 ) = 1