emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] noob question : In a table , how to update a formula when


From: Nick Dokos
Subject: Re: [Orgmode] noob question : In a table , how to update a formula when inserting a new line
Date: Fri, 07 May 2010 22:56:49 -0400

Matt Chastagnier <address@hidden> 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(@address@hidden)
> 
> 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(@address@hidden)
> 
> 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(@address@hidden)

HTH,
Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]