emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Rustom Mody <rustompmody@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: making flexible table formulas
Date: Tue, 1 Mar 2011 10:08:52 +0100	[thread overview]
Message-ID: <0DA892CF-1356-48EE-AEDD-B7AB9E84862F@gmail.com> (raw)
In-Reply-To: <AANLkTim1FhPLotsjEMfV+V0BpF0+PmJ9fcUXSDH6KutA@mail.gmail.com>


On 28.2.2011, at 18:35, Rustom Mody wrote:

> When using orgmode for hacking on data in a table (org a la spreadsheet)  I have this situation
> Say I am concentrating on column 2 and I want the bottom cell to be the sum of the above cells
> For a 7 row table with 8th row having the total I get
> 
>   #+TBLFM: @8$2=vsum(@1$2..@7$2)
> 
> But now I have a problem: If say I add a row to the table then the next time I recompute the formula(s) the ninth row is not affected and the 8th row which is now data gets overwritten with a computation.

Hi Rustom,

in addition to the excellent advice you have already gotten in this thread,
I would like to add the following piece of information (if only to make
the thread a more complete online reference):

Apparently you have been inserting new rows with normal editing commands like
RET or `C-o'.  If you use Org's special commands to insert new rows, for example
M-S-<down> on the last row, the row references in the formula will be adjusted
to

 @9$2=vsum(@1$2..@7$2)

So you see that the @8 has become a @9.  However, the @7 has not been
adjusted because Org has no way of telling what you meant.  So even if
you write your formula with @8$2=, you should use relative references to
refer to the fields when summing:

@8$2==vsum(@1$2..@-1$2)


Anyhow, the methods proposed by Nick and Luke are much better in this case.

Hope this helps

- Carsten


> 
> So basically I want the @1 and @7 which are hardcoded above to be replaced by something to the effect: "everything above..." and the @8$2 should be something to the tune of "bottom of $2"
> 
> I guess this may not be a reasonable request -- but with org you never know :-) so asking if there is some way.
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  parent reply	other threads:[~2011-03-01 10:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 17:35 making flexible table formulas Rustom Mody
2011-02-28 18:14 ` Luke Crook
2011-02-28 18:18 ` Nick Dokos
2011-03-01  9:08 ` Carsten Dominik [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-03-01  3:19 Rustom Mody
2011-03-01  4:41 ` theo
2011-03-01  5:10 ` Nick Dokos

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=0DA892CF-1356-48EE-AEDD-B7AB9E84862F@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rustompmody@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).