From mboxrd@z Thu Jan 1 00:00:00 1970 From: henry atting Subject: Re: delete, add new row Date: Fri, 02 Dec 2011 10:59:01 +0100 Message-ID: <8739d3mh0a.fsf@bye.fritz.box> References: <87fwh4i3ye.fsf@bye.fritz.box> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:43915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWPtE-0001pA-2m for emacs-orgmode@gnu.org; Fri, 02 Dec 2011 04:58:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWPtC-0008Gh-G4 for emacs-orgmode@gnu.org; Fri, 02 Dec 2011 04:58:43 -0500 Received: from moutng.kundenserver.de ([212.227.17.8]:61241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWPtC-0008G4-4D for emacs-orgmode@gnu.org; Fri, 02 Dec 2011 04:58:42 -0500 In-Reply-To: (Jonathan Leech-Pepin's message of "Thu, 1 Dec 2011 15:23:39 -0500") 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: Jonathan Leech-Pepin Cc: emacs-orgmode@gnu.org Jonathan Leech-Pepin writes: > 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. =C2=A0If 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=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 be looking for. =C2=A0T= he > 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: >=20=20=20=20=20 > | 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 >=20=20=20=20=20 > 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. >=20=20=20=20=20 > | 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 >=20=20=20=20=20 > If I push the second row to the bottom the > result is as if the last row is still the second one. >=20=20=20=20=20 > | 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 >=20=20=20=20=20 Ah, I see the problem; and thanks, it works fine now. henry --=20 http://literaturlatenight.de