How to achieve a row index column in Emacs Org Mode using a Calc column rule

∥☆過路亽.° 提交于 2019-12-03 05:46:06

This example uses @# to get the row number. Similarly, $# returns the column number.

| row | data |
|-----+------|
| 2   | 0303 |
| 3   | 5123 |
| 4   | 41   |
| 5   | 4234 |
#+TBLFM: $1=@#

It's often necessary, for example with descriptive rows, to start counting rows only from certain horizontal lines with 1, below for the first horizontal line: #+TBLFM: $1=vlen(@I..0). This means calculate the length of the row range from the first hline @I (the second would be @II, ...) to the current (0) row.

|bla|blabla|
|---+------|
|1  | bla  |
|2  | bla  |
#+TBLFM: $1=vlen(@I..0)

or, for above example, also simply #+TBLFM: $1=@#-1 :-)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!