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
-
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?
-
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
-
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 problemYou 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.
Content aside
- 2 yrs agoLast active
- 5Replies
- 65Views
-
2
Following