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

  • 0
  • 1
  • Question
  • Updated 7 months ago
  • Answered
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,
Photo of Katherine Phung

Katherine Phung

  • 248 Points 100 badge 2x thumb

Posted 7 months ago

  • 0
  • 1
Photo of Matthew Neil

Matthew Neil

  • 31,478 Points 20k badge 2x thumb
Lets simplify it to:

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

Katherine Phung

  • 248 Points 100 badge 2x thumb
Thanks Matthew!