2

I am having hard time trying to figure out how to add contents of multiple fields.

It isn't quite obvious from Org mode manual as issue like this should be.

I'm trying to find a formula to sum the entry in fields @2$5 to @5$5 and make an entry of the sum in @6$5.

Now I found that something like @2$5..@5$5 can be used to refer to range of fields, but how do I find the sum of them?

I tried sum(@2$5..@5$5) and add(@2$5..@5$5), but apparantly there's no such functions.

Bibek_G
  • 215
  • 1
  • 5

2 Answers2

3

The formulas are evaluated by the calc package, and its manual is the goto place for functions lookup. (This manual can be quite overwhelming, but you will only visit a few pages most of the time.)

Usually, functions that operate on a single vector (in your case you want to sum coefficients of a vector) are prefixed by v, and indeed here vsum is what you're looking for.

You can find a list of these functions here.

T. Verron
  • 4,233
  • 1
  • 22
  • 55
2

If you're more comfortable with elisp than calc functions, you can also do something like this:

'(apply #'+ '(@2$5..@5$5));N

See the Org manual for more details.

Aaron Harris
  • 2,664
  • 17
  • 22