emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: "Daniel J. Sinder" <djsinder@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Including row numbers in a table
Date: Sat, 09 Aug 2008 01:59:37 -0400	[thread overview]
Message-ID: <87vdyau3sm.fsf@gollum.intra.norang.ca> (raw)
In-Reply-To: <489D1FDB.2010603@gmail.com> (Daniel J. Sinder's message of "Fri\, 08 Aug 2008 21\:40\:59 -0700")

"Daniel J. Sinder" <djsinder@gmail.com> writes:

> I haven't used table formulas that much and I can't figure this one
> out.  I'd like to include row numbers in the table itself. Something
> like this:
>
>   | Row | Data Column 1  | Data Column 2       |
>   |-----+----------------+---------------------|
>   |   1 | some data      | more data           |
>   |   2 | some more data | even more data      |
>   |-----+----------------+---------------------|
>   |   3 | still more     | yup, you guessed it |
>   |   4 | and more       | that's all          |
>
>
> I'd like to use a formula for the first column so that if I move rows
> around using org commands, the row numbers can be easily
> re-calculated.  Note that I'd like numbering to continue sequentially
> across horizontal lines.
>
> I've tried column formulas like @-1+1, but the horizontal lines get in
> the way.  And if every row needs it's own formula, it's hardly better
> than just filling in the numbers.
>
> Can anyone suggest how to do this is a reasonably automated fashion?
>


  | Row | Data Column 1  | Data Column 2       |
  |-----+----------------+---------------------|
  |   1 | some data      | more data           |
  |   2 | some more data | even more data      |
  |-----+----------------+---------------------|
  |   3 | and more       | that's all          |
  |   4 | still more     | yup, you guessed it |
  |-----+----------------+---------------------|
#+TBLFM: $1=find(@I$2..@III$2,$2)

This assumes the data in Data Column 1 ($2) is unique

-Bernt

  reply	other threads:[~2008-08-09  5:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-09  4:40 Including row numbers in a table Daniel J. Sinder
2008-08-09  5:59 ` Bernt Hansen [this message]
2008-08-09  6:57   ` Bernt Hansen
2008-08-09  7:04     ` Bernt Hansen
2008-08-09  8:16       ` Daniel J. Sinder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vdyau3sm.fsf@gollum.intra.norang.ca \
    --to=bernt@norang.ca \
    --cc=djsinder@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).