ListSum ( myList )

Add up a list of numbers

Sample input:
1
2
3
Sample output:
6

Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This replaces the list's carriage returns with semicolons so that the Sum function can be used, e.g. Sum(1;2;3). Non-recursive. Works with negative numbers.

Inspired by comments on the SUMLIST function.

Original from May 2011
Updated Aug. 2013
Now works with single (or empty) lists, per Mr. Cheang's comment below. Thanks to him and also to Agnès for pointing out that this only works for up to 1000 values (see comments below). It also doesn't do any other error checking such as if you feed in a bunch of blank lines or other nonsense.

 Agnès, FranceMay 25, 2011 Hello, Be carreful with this type of calculation using Evaluate ( Max or Evaluate ( Min or Evaluate ( Sum (...) The result will be "?" if you have 1001 values in your list
 Tom FitchMay 25, 2011 Thanks, Agnès! You're correct. I wasn't able to locate any documentation of this limitation, and I'd like to know more about it. Can you point me to a reference?
 Agnès, FranceMay 26, 2011 I have no reference for this, just the tests I did with Evaluate and calculations in FileMaker. There is no problem, usually we use this calculation on small lists, until the day where. this is what happened to me. to test : Let ([ myList = Customlist ( 1 ; nbr ; "[n]" ) ; it = Substitute( myList ; ¶ ; ";" ) ; Su = Substitute( myList ; ¶ ; "+" ) ]; Evaluate( "Sum(" & it & ")" ) // Limit nbr : 1000 & ¶ & Evaluate( Su ) // limit nbr : 5238 ) Let ( \$Count = 0 ; Customlist ( 1 ; nbr ; "Let ([ \$Count = \$Count + [n] ]; """" )" ) & \$Count ) // limit nbr : 500000
 Tom FitchMay 26, 2011 Interesting. Thanks again for the info.
 Bernard Cheang, SingaporeDec 29, 2011 It also doesn't work if you only have one item in the list. You need to do a check and append a "0" to the supplied list if there is only one item.
 Kostas Papavasileiou, AthensAug 21, 2013 I m trying to sum up the Grand Totals of Time Billings at the Time Billings Layout. I m pretty novice. What's the function to add in the DB, please? having lost already ... Thank you very much ...
 Tom FitchAug 21, 2013 Mr. P, this isn't really a support site (and I don't understand your question). I suggest fmforums.com or filemaker.com/technet/
 Kostas Papavasileiou, AthensAug 22, 2013 Thank you very much! I will do so! Didn't see that was not right on my behalf to ask. Thakn you again.
 Bill, Portland, OregonSep 8, 2013 Thanks, Tom---just what I was looking for today. 67% Shotgun
 Mike Gallagher, Ft LauderdaleFeb 5, 2014 Thanks as well... simplify the first argument to the following: myList = myList and it will work for standard deviation as well, e.g.: result = Evaluate( "STDEV(" & it & ")" )

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:

Under construction. Email me your wish list for improvements.