4 Replies Latest reply on Oct 12, 2009 12:32 PM by philmodjunk

    How to Create an "If" Calculation



      How to Create an "If" Calculation


      Hi guys,


      I'm looking to create a simple calculation that will add up the selections of a given field. For example, rental costs are;


      Projector = $360

      DVD Player = $50

      Screen = $75


      My formula is below and only works when you select one item. But it doesn't add up the selections if there are more then one selected. 


      (If ( Audio Visual = "2000 LM Projector" ; 360)) + (If ( Audio Visual = "DVD Player" ; 50)) + (If ( Audio Visual = "8' Screen & Skirt" ; 75)) 


      What am I doing wrong in this formula? 

        • 1. Re: How to Create an "If" Calculation
             Seems like you have a real structural issue here. Why are you putting the costs in a calc?
          • 2. Re: How to Create an "If" Calculation

            "IF" statements require a false option.  Either change your IF to CASE, or add in a false option for IF.


            For example:


            (If ( Audio Visual = "2000 LM Projector" ; 360; 0)) + (If ( Audio Visual = "DVD Player" ; 50; 0)) + (If ( Audio Visual = "8' Screen & Skirt" ; 75; 0))


            Each IF statement needed the "; 0".  So for the first Calc it will return 360 when true, but it will return 0 when false.


            Having said that I agree with mr_vodka in that this approach seems strange.




            • 3. Re: How to Create an "If" Calculation

              Chadams wrote:

              "IF" statements require a false option.


              I cant say that I agree with that statement.



              I took the OP's issues as having values with a checkbox, in which case using PatternCount or FilterValues would be used. However, I still stand by my issues that I have as stated in my orig post.

              • 4. Re: How to Create an "If" Calculation

                I agree with Mr. Vodka. If you use the Advanced link to search this forum, using "invoice" as your search text, you'll find a number of relevant threads on the subject.


                You probably should be listing these items in a portal with one item in each related record.