0

Formula for adding

Hello everyone

  There are several numbers that need to be added, but the fact is that they need to be added if they differ from a certain amount. For example, if the first digit differs from the sum of 556, it must be plused, if it is equal to 556 then ignore, plus all the rest

regards

5 replies

null
    • Fred
    • 1 yr ago
    • Reported - view

    Are you asking to compare the first digit in a number field to the sum of 5+5+6?

    The sum of 5+5+6 is 16 so how can one digit equal anything greater than 9?

      • ekalcasino777
      • 1 yr ago
      • Reported - view

      Fred "Number of chips 1" well be default value of field "Number 1"

       

      I previously solved this problem by giving a "default value" field. But now a situation has arisen when this value changes but employees do not have access to the administrative part of the program. I wanted to decide this way, create one more field, Numbers, and what we write there should be the default value for the main field. But I couldn't solve this problem

    • ekalcasino777
    • 1 yr ago
    • Reported - view

    I have three fields in which values are already written. I'm creating a formula where only numbers should sum after changing them. For example, the values in the first field are 300, in the second 400, in the third 500. I don't need to sum them. but if in one or two of them change, I need to make a plus only of the changed fields

    • Fred
    • 1 yr ago
    • Reported - view

    You seem to be asking two questions:

    Question 1:

    ekalcasino777 said:
    I wanted to decide this way, create one more field, Numbers, and what we write there should be the default value for the main field. But I couldn't solve this problem

     You can put in the Trigger after update of the new Number1 field to set the value in another field equal to what is in Number1.

    otherfieldname := Number1

    Or you can use a button.

    Question 2:

    For example, the values in the first field are 300, in the second 400, in the third 500. I don't need to sum them. but if in one or two of them change, I need to make a plus only of the changed fields

    One possible solution, if you don't need to track the changes, is to create three new number fields (field1change, field2change, field3change) then put this in the Trigger after update:

    field1 trigger:
    field1change := 1
    
    field2 trigger:
    field2change := 2
    
    field3 trigger:
    field3change := 4

    Why these values? So when we add up any two numbers we get a unique value so we know what fields got changed.

    and a new formula field (changesum) with the code of:

    field1change + field2change + field3change

    Then in your formula field to sum the fields that changed you can put:

    switch changesum do
    case 1:
    field1change
    case 2:
    field2change
    case 3:
    field1change + field2change
    case 4:
    field3change
    case 5:
    field1change + field3change
    case 6:
    field2change + field3change
    case 7:
    field1change + field2change + field3change
    end

    You could use if statements but with this many variables it would be a mess.

      • ekalcasino777
      • 1 yr ago
      • Reported - view

      Fred 

      i used the formula 'Number 1' := 'Number of chips 1' , it completely solved my problem.

        Thanks for help

Content aside

  • 1 yr agoLast active
  • 5Replies
  • 55Views
  • 2 Following