Forum Discussion

KatherinePhung's avatar
KatherinePhung
Qrew Trainee
7 years ago

How to create 'If' function in formula-number?

Hi, I need help. I'm putting together a formula: 

If [Rem15 Preliminary # of Stories] is not null, [Confirmed Stories] field is equal to the value in [Rem15 Preliminary # of Stories]. 
If [Rem15 Preliminary # of Stories] is null, [Confirmed Stories] is equal to the value in [REM 14 Projected Stories].

This is what I have in the [Confirmed Stories] 'formula-number' field:

var number newPStories = If(not IsNull([Rem15  Preliminary # of Stories]), 1, 0);
If ($newPStories = 1, [Rem15  Preliminary # of Stories],
    $newPStories = 0, [REM 14 Projected Stories])
 
However, the outputs are wrong, see screenshot below:
 

How can I adjust the formula to make the 2nd row and 3rd row display as '1' and '2' instead of '0'? 

Thanks,
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    Lets simplify it to:

    If(IsNull([Rem15  Preliminary # of Stories]), [REM 14 Projected Stories],  [Rem15  Preliminary # of Stories])