the $1 column of my table is just an i++ value, 1, 2, 3 ... n where n is the number of rows between the 2nd and 3rd hline. is there a function I can call to tell me how many rows are in that part of my table, or, if I want to be able to refer to a variable which is the number of rows in my table, do I have to keep track of it manually like this? so what I want to be able to do is the following, without having to use a count up column.
@7$1 = Total(5), where "5" is the number of rows between the 2nd and 3rd hline
| num rows | x | y |
|----------+---+---|
| 1 | | |
| 2 | | |
| 3 | | |
| 4 | | |
| 5 | | |
|----------+---+---|
| Total(5) | | |
|----------+---+---|
#+TBLFM: @7$1=Total(@-1)
So this is what I have now, I would like to be able to get the number of rows between 2 hlines without having to use a dedicated column to keep that count.
Two variants come to mind, one using Calc's vector length function vlen
, the other using elisp's length
, which gives the size of a list:
| Item |
|---------------|
| tomato |
| banana |
| space shuttle |
| orgmode |
|---------------|
| 4 |
| 4 |
#+TBLFM: @6$1='(length '(@I..@II))::@7$1=vlen(@I..@II)
@I..@II
means all rows between the first and second hlines.