From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Leech-Pepin Subject: Re: delete, add new row Date: Thu, 1 Dec 2011 15:23:39 -0500 Message-ID: References: <87fwh4i3ye.fsf@bye.fritz.box> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf303ea0bab6e33804b30da047 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:40537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWDAU-0003eX-3Y for emacs-orgmode@gnu.org; Thu, 01 Dec 2011 15:23:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWDAS-0004lG-EM for emacs-orgmode@gnu.org; Thu, 01 Dec 2011 15:23:42 -0500 Received: from mail-gx0-f169.google.com ([209.85.161.169]:33405) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWDAS-0004lC-Ah for emacs-orgmode@gnu.org; Thu, 01 Dec 2011 15:23:40 -0500 Received: by ggnq4 with SMTP id q4so2714543ggn.0 for ; Thu, 01 Dec 2011 12:23:39 -0800 (PST) In-Reply-To: <87fwh4i3ye.fsf@bye.fritz.box> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: henry atting Cc: emacs-orgmode@gnu.org --20cf303ea0bab6e33804b30da047 Content-Type: text/plain; charset=UTF-8 I'm not sure as to the reason why it does so, but based on your example, the formula is referencing the specific cell itself, rather than the relative position of the cell. If you change your formula to use a relative reference, it will continue to work even when you add, remove and move the rows. #+TBLFM: @2$3..@>$3=vmean(@I$2..@0$2);%.1f or #+TBLFM: @2$3..@>$3=vmean(@<<$2..@0$2);%.1f will both provide you with the result you seem to be looking for. The former uses your (first) horizontal line as the starting point, whereas the latter uses the 2nd row from the top. Regards, Jonathan On Thu, Dec 1, 2011 at 12:42, henry atting wrote: > Suppose I have this table: > > | month | expenses | average | > |-------+----------+---------| > | 1 | 20 | | > | 2 | 30 | 25.0 | > | 3 | 40 | 30.0 | > #+TBLFM: @3$3..@>$3=vmean(@2$2..@0$2);%.1f > > Then I want to delete the second row and add a new one at the bottom. > If I do so I get `#ERROR' on every recalculation. > > | month | expenses | average | > |-------+----------+---------| > | 2 | 30 | #ERROR | > | 3 | 40 | #ERROR | > | 4 | 50 | #ERROR | > #+TBLFM: @2$3..@>$3=vmean(@INVALID$2..@0$2);%.1f > > If I push the second row to the bottom the > result is as if the last row is still the second one. > > | month | expenses | average | > |-------+----------+---------| > | 2 | 30 | 30.0 | > | 3 | 40 | 30.0 | > | 1 | 20 | 20.0 | > #+TBLFM: @2$3..@>$3=vmean(@4$2..@0$2);%.1f > > > henry > > -- > http://literaturlatenight.de > > > --20cf303ea0bab6e33804b30da047 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I'm not sure as to the reason why it does so, but based on your ex= ample, the formula is referencing the specific cell itself, rather than the= relative position of the cell. =C2=A0If you change your formula to use a r= elative reference, it will continue to work even when you add, remove and m= ove the rows.

#+TBLFM: @2$3..@>$3=3Dvmean(@I$2..@0$2);%.1f= =C2=A0
or
#+TBLFM: @2$3..@>$3=3Dvmean(@<<$= 2..@0$2);%.1f
will both provide you with the result you seem to b= e looking for. =C2=A0The former uses your (first) horizontal line as the st= arting point, whereas the latter uses the 2nd row from the top.

Regards,
Jonathan

On Thu, Dec 1, 2011 at 12:42, henry atting <nsmp_02@online.de> wrote:
Suppose I have this table:

| month | expenses | average |
|-------+----------+---------|
| =C2=A0 =C2=A0 1 | =C2=A0 =C2=A0 =C2=A0 20 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=
| =C2=A0 =C2=A0 2 | =C2=A0 =C2=A0 =C2=A0 30 | =C2=A0 =C2=A025.0 |
| =C2=A0 =C2=A0 3 | =C2=A0 =C2=A0 =C2=A0 40 | =C2=A0 =C2=A030.0 |
#+TBLFM: @3$3..@>$3=3Dvmean(@2$2..@0$2);%.1f

Then I want to delete the second row and add a new one at the bottom.
If I do so I get `#ERROR' on every recalculation.

| month | expenses | average |
|-------+----------+---------|
| =C2=A0 =C2=A0 2 | =C2=A0 =C2=A0 =C2=A0 30 | =C2=A0#ERROR |
| =C2=A0 =C2=A0 3 | =C2=A0 =C2=A0 =C2=A0 40 | =C2=A0#ERROR |
| =C2=A0 =C2=A0 4 | 50 =C2=A0 =C2=A0 =C2=A0 | =C2=A0#ERROR |
#+TBLFM: @2$3..@>$3=3Dvmean(@INVALID$2..@0$2);%.1f

If I push the second row to the bottom the
result is as if the last row is still the second one.

| month | expenses | average |
|-------+----------+---------|
| =C2=A0 =C2=A0 2 | =C2=A0 =C2=A0 =C2=A0 30 | =C2=A0 =C2=A030.0 |
| =C2=A0 =C2=A0 3 | =C2=A0 =C2=A0 =C2=A0 40 | =C2=A0 =C2=A030.0 |
| =C2=A0 =C2=A0 1 | =C2=A0 =C2=A0 =C2=A0 20 | =C2=A0 =C2=A020.0 |
#+TBLFM: @2$3..@>$3=3Dvmean(@4$2..@0$2);%.1f


henry

--
http://literatur= latenight.de



--20cf303ea0bab6e33804b30da047--