Discussions

Expand all | Collapse all

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

  • 1.  How to create 'If' function in formula-number?

    Posted 05-02-2018 23:50
    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:
    ">https://d2r1vs3d9006ap.cloudfront.net/s3_images/1728119/RackMultipart20180502-22600-1giv1lt-Capture_1_inline.PNG?1525304912"> 

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

    Thanks,


  • 2.  RE: How to create 'If' function in formula-number?

    Top
    Contributor
    Posted 05-03-2018 03:45
    Lets simplify it to:

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


  • 3.  RE: How to create 'If' function in formula-number?

    Posted 05-03-2018 15:56
    Thanks Matthew!