# Basic math with Multiple values in same field

## 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
##### 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
• 1
##### 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

## Create an account

Register a new account

×
×
• Create New...