From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: Including row numbers in a table Date: Sat, 09 Aug 2008 01:59:37 -0400 Message-ID: <87vdyau3sm.fsf@gollum.intra.norang.ca> References: <489D1FDB.2010603@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KRhUQ-0007y7-WA for emacs-orgmode@gnu.org; Sat, 09 Aug 2008 01:59:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KRhUP-0007wk-Tr for emacs-orgmode@gnu.org; Sat, 09 Aug 2008 01:59:46 -0400 Received: from [199.232.76.173] (port=39924 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KRhUP-0007wS-Ou for emacs-orgmode@gnu.org; Sat, 09 Aug 2008 01:59:45 -0400 Received: from mho-02-bos.mailhop.org ([63.208.196.179]:59880) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KRhUP-0000sq-5D for emacs-orgmode@gnu.org; Sat, 09 Aug 2008 01:59:45 -0400 In-Reply-To: <489D1FDB.2010603@gmail.com> (Daniel J. Sinder's message of "Fri\, 08 Aug 2008 21\:40\:59 -0700") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Daniel J. Sinder" Cc: emacs-orgmode@gnu.org "Daniel J. Sinder" 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