From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Table calculation question Date: Mon, 27 Aug 2007 04:25:52 +0200 Message-ID: <9e1e955822ffc5530c99ca4d8b0ffc2e@science.uva.nl> References: <871wdqhypu.fsf@gollum.intra.norang.ca> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IPUIj-0006kk-4b for emacs-orgmode@gnu.org; Sun, 26 Aug 2007 22:26:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IPUIg-0006kY-OU for emacs-orgmode@gnu.org; Sun, 26 Aug 2007 22:25:59 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IPUIg-0006kV-JP for emacs-orgmode@gnu.org; Sun, 26 Aug 2007 22:25:58 -0400 Received: from korteweg.uva.nl ([146.50.98.70]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IPUIg-0004Rh-AA for emacs-orgmode@gnu.org; Sun, 26 Aug 2007 22:25:58 -0400 In-Reply-To: <871wdqhypu.fsf@gollum.intra.norang.ca> 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: Bernt Hansen Cc: emacs-orgmode@gnu.org On Aug 26, 2007, at 21:39, Bernt Hansen wrote: > In the following table I'd like to vertically sum the column and the > compute a new value based on that sum. > > |---+---+---+---+-------+---------| > | | A | B | C | Total | Details | > |---+---+---+---+-------+---------| > | # | 1 | 2 | 4 | 7 | Item 1 | > | # | 2 | 6 | 4 | 12 | Item 2 | > | # | 2 | 4 | 4 | 10 | Item 3 | > | # | 2 | 6 | 3 | 11 | Item 4 | > |---+---+---+---+-------+---------| > | # | | | | 40 | 400.00 | > | ^ | | | | tot | result | > | $ | | | | | kval=10 | > |---+---+---+---+-------+---------| > #+TBLFM: $5=$2+$3+$4::$tot=vsum(@-II..@-I)::$result=$tot*$kval;%.2f > > If I edit any of the values in columns A, B, C and do C-u C-c C-c then > the total (tot) value is recalculated but result is not. Doing C-u C-c > C-c a second time recalculates result based on the new tot value. > > Is there a way to do this in a single table recalculation? `C-u C-u C-c C-c' iterates a table until it is stable and in this way takes care of formulas depending on calculated fields. If you want to do this all the time you can do something like (add-hook 'org-mode-hook (lambda () (local-set-key [f5] (lambda () (interactive) (org-table-recalculate '(16)))))) - Carsten