Does Calc have a summation function?

There is SUMIF(range; criteria; sum_range) function in Calc, which “Adds the cells specified by a given criteria. The search supports regular expressions. Range is the range to which the criteria are to be applied. Criteria is the cell in which the search criterion is shown, or the search criterion itself. Sum_range is the range from which values are summed; if it has not been indicated, the values found in the Range are med.”.
Information about all Calc function you can find here (Appendix B - Calc Functions). I hope this information will be helpful for you.

Article in documentation with example about SUMIF function -

Thanks for that info. Actually, I have already browsed all of Calc’s functions on that page before, and I do know about SUMIF(), but that’s another array-based solution. What I’m looking for is a single-cell function where you can input all the data you need as arguments.

can help.
See in the help how it works.
To access the menu entry first select a range.

Maybe it is possible to do with an array expression, but with a more detailed explanation about what to do, would be easier to find a solution.

Yeah, my current solution is array-based, but that takes up so much space than if there were a single function to fill one cell with. Additionally, trying to account for the variable nature of the upper and lower bounds is pure hell.

Sum of (5 + 6 i), where (i) ranges from (0) to (N), will be (N (3 N + 8) + 5). Pretty straightforward.

Based on my original question, and after doing a bit more research, it’s become painfully obvious that LibreOffice Calc simply does not have a function for summations. There is no single function, or even combination of functions, that will calculate the sum of an expression f(x) from x=a to b (there are workarounds, but all techniques I’ve heard from others are array-based, not single-cell solutions).

The interesting thing is that my calculator has this pretty basic function, and the syntax and logic isn’t even that difficult to implement. I suppose there just aren’t enough people asking for an implementation of this function.

I’m still trying to implement it myself through the Basic programming language, but I’m also having a bit of trouble finding documentation for it. Maybe when I have free time, I’ll decide to learn how to create an extension for it so other people might be able to use it.

@TJMeneses The solution I demonstrate in my answer is, of course, array based, but doesn’t need evaluation of many cells, hower, as you will see.

BTW Who did mark this non-answer as correct?

“Who did mark this non-answer as correct?” : There are 2 sets of people allowed to select correct answers:- either the Questioner or a Moderator. My uninformed guess is that the OP selected it.

This requires the Eval() function from here, but this seems to work fine:

Function SUMMATION(lowerbound, upperbound, variable, formula)
	FOR i=lowerbound to upperbound
		this=join(split(formula, variable), i)
End Function

There isn’t an EVAL function available for user programming for Calc.

It most certainly does have a summation function, and it is named… SUM!

Your problem is that you must select a range of cells. For example, if I wish to sum cells A1 through A7, the code would be a simple


Hope this helps.

The original questioner explicitly stated that, and for what reasons, SUM wasn’t a solution for his problem.

I’m quite disappointed. The “SUM()” function was one of the foundation operators in VisiCalc, it is simple and straightforward in spreadsheet products where it is implemented correctly. Unfortunately on LibreOffice, this formula:

  • =SUM(R2C:R14C)

Row/Column reference, it Displays: “.00”

The correct answer is there are two numbers in that column that add to 737, the rest of the cells are empty. EVERY single spreadsheet I’ve ever used and that’s at least half-a-dozen all give me 737.

@aplatypus: May I ask you to prove your statement?
You may refer to the example I will attach to my original answer (2015-07-26)

(Just coming to this thread by accident, I will try a structured answer.)

  1. If the developers addressed the request it wasn’t to simply add a function to the given supply, usable just for adding or even more general purposes, but to introduce and implement a new concept: bound variables suitable to describe the variation of an expression when having the bound variable running through a (discrete) range. Lets call the construct a Calculating Loop (CL). Mathematical software I know actually provides one or more functions implementing CL. There may be a SUM and a PRODUCT accepting running indizes. Surely there is at least one function returning a vector or a matrix based on (a) loop(s) to go through. One of the functions may allow for an expression VECTOR(EXP(k*LN(π)),k,0,10), and SUM(VECTOR(EXP(k*LN(π)),k,0,10)) may then return the values of π to the zeroth through tenth power added up. (The formula as shown will work in old DERIVE, e.g.)

You see: At least in the background there must be generated a vector (or a matrix of higher dimension) which then can be passed to a function for summing, or whatever …

  1. Can we do this within a Calc formula, too? Yes! Within reason! The only way to actually do it is, however, to use (abuse ?) the functions ROW() or/and COLUMN() for the generation of a running index under the condition of so called array-evaluation. The mentioned example would then read:


The first one entered as an array formula (Ctrl+Shift+Enter), the second one forcing array evaluation according to the specification of SUMPRODUCT.

This also demonstrates a way to apply a range not strictly limited to successive positive integer values.

  1. There are issues, of course. I think we cannot introduce 3 or more independent bound variables this way, and we will get complicated formulae if the bound variable(s) shall occur in more than one places anyone.

[Edit with respect to the comment by @aplatypus 2016-07-05 ]
The announced example: ask835SumFunctionRCnotation001.ods

You can create a user defined function in basic to return an array of integers from the lower to upper bound, then use an array function inside the SUM function.

Example:- (Edit to match example of OP)

=SUM( 5 + 6 * RANGEARRAY(1,10))

Where RANGEARRAY is defined as :-

REM  *****  BASIC  *****

Option Explicit

Function RANGEARRAY(lower As Long, upper As Long) As Variant

	Dim v As Variant
	Dim i As Long
	If upper >= lower Then
		Redim v ( 0 To upper - lower)
		For i = 0 to upper - lower
			v( i ) = lower + i
		Next i
	End If
	RangeArray = v
End Function

Note that as the array function is summed by the SUM function to a single value there is no need to enter the expression as an array function. If RANGEARRAY is used without the SUM function, then you need to enter as an array function, using ctrl-shift-Enter, in which case it returns a horizontal array of cells.

only thing i can think of is rationalising it as an equation:


unfortunately it only works for a basic additive equation (1+2+3…), and doesn’t work for anything fancy like indices, though i’ve not tried it with multiplication or division. i based it on the idea that 1+4 and 2+3 both give you 5, so n=5, ∑(n)=15.

gotta love sigma.