emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Matt Chastagnier <workandroll@gmail.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: noob question : In a table , how to update a formula when inserting a new line
Date: Fri, 07 May 2010 22:56:49 -0400	[thread overview]
Message-ID: <8026.1273287409@gamaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Matt Chastagnier <workandroll@gmail.com> of "Sat, 08 May 2010 04:21:34 +0200." <AANLkTinbps0toXMuVy77qaEFrpJCxuVOmBZQJMOtrAOY@mail.gmail.com>

Matt Chastagnier <workandroll@gmail.com> wrote:

> I've just started with org-mode and have done several tutorials. But I'm
> stuck with this problem for 3 hours :
> 
> 
> I have :
> 
> | item    | quantity |
> |---------+----------|
> | laptop  |        4 |
> | desktop |        7 |
> |---------+----------|
> | Total   |       11 |
> 
> #+TBLFM: @4$2=vsum(@I..@II)
> 
> I insert a new line [because I will want to add a new item] (M-S down) and
> update the table (C-u C-c C-c) :
> 
> | item    | quantity |
> |---------+----------|
> | laptop  |        4 |
> | desktop |        7 |
> |         |       11 |
> |---------+----------|
> | Total   |       11 |
> 
> #+TBLFM: @4$2=vsum(@I..@II)
> 
> but my formula isn't updated automatically so the wrong field is updated. I
> would like the formula to become @5$2 instead of @4$2 automatically.
> I've searched during 2 hours with google but found nothing :/ ... Is it
> possible to do it? Cause It's very annoying to update the formula "by hand"
> (sorry for my english).
> 

You looked in the wrong place :-) If you look in section 3.5.1,
"References", in the Org manual, you'll find

,----
|    As a special case, references like `$LR5' and `$LR12' can be used to
| refer in a stable way to the 5th and 12th field in the last row of the
| table.
`----


So make your formula

#+TBLFM: $LR2=vsum(@I..@II)

HTH,
Nick

  reply	other threads:[~2010-05-08  2:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-08  2:21 noob question : In a table , how to update a formula when inserting a new line Matt Chastagnier
2010-05-08  2:56 ` Nick Dokos [this message]
2010-05-08  3:48 ` w t
2010-05-08 16:06   ` Matt Chastagnier

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=8026.1273287409@gamaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=workandroll@gmail.com \
    /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).