Jump to content

Basic math with Multiple values in same field


This topic is 1163 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm trying to make basic addition with values in a field.

Field A contains a text of numbers 10,4,2,5

Field B is my calculation field where i want the result of field A. (10+4+2+5)

Sum (Field A) just gives me 10425 instead of 21, and i cant find other functions to solve this.

Any help is appreciated

Edited by JohnDing
Link to comment
Share on other sites

First thing: if you need to sum individual values, enter them into separate fields and/or records, not in a single field.

Next, your field does NOT contain "a set of numbers". It contains text. When you attempt to perform a numerical operation on this text, it is converted to a number by extracting the digit characters.

Now, there is a way to sum the values in a comma-separated string: substitute the commas with a "+" character, then use the Evaluate() function on the result. However, if your field contains a trailing comma (as shown in your example), there is an additional complication because: 

10+4+2+5+

is not a valid expression. If the field always contains a trailing comma, you could do:

Evaluate ( Substitute ( Field A ; "," ; "+" ) & "0" )

to get 21.

 

Edited by comment
  • Thanks 1
Link to comment
Share on other sites

Totally missed Evaluate, that was the missing function. I'm just doing:

Evaluate (Field A)

To get my 21.

The trailing comma was a typo (my bad), and I replaced the commas with "+". 

Will edit my text to contains text instead of numbers.

 

Thanks again Comment

Link to comment
Share on other sites

This topic is 1163 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.