From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Boudreault Subject: Re: Re: org-table and formulas Date: Wed, 13 Jan 2010 06:14:12 -0500 Message-ID: <4B4DAB04.5000503@mapgears.com> References: <4B4B7CD5.80907@mapgears.com> <87y6k2gv6h.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NV1Ao-0001Mh-OY for emacs-orgmode@gnu.org; Wed, 13 Jan 2010 06:14:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NV1Ak-0001Kh-Pw for emacs-orgmode@gnu.org; Wed, 13 Jan 2010 06:14:02 -0500 Received: from [199.232.76.173] (port=47718 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NV1Ak-0001Kc-IN for emacs-orgmode@gnu.org; Wed, 13 Jan 2010 06:13:58 -0500 Received: from smtp121.iad.emailsrvr.com ([207.97.245.121]:48244) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NV1Ak-0008Gh-4k for emacs-orgmode@gnu.org; Wed, 13 Jan 2010 06:13:58 -0500 In-Reply-To: <87y6k2gv6h.fsf@mundaneum.com> 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: =?UTF-8?B?U8OpYmFzdGllbiBWYXViYW4=?= Cc: emacs-orgmode@gnu.org Hi S=C3=A9bastien and thank you for your answer. The problem with that technique is that I'll have to name ALL the cell=20 for ALL the colomn. Here's an example of my table: #+TBLNAME: FOOD | Name | Brand | Amounts (g) | Calories | Protein |=20 Carbohydrate | Fat | =20 |-----------------+---------------+-------------+----------+---------+---= -----------+------| | Poitrine Poulet | KirkLand | 100 | 100 | =20 24 | 0 | 1 | | Capeli d'angelo | Primo | 85 | 300 | =20 10 | 63 | 1 | | Couscous | Clic | 62 | 220=20 | 8 | 46 | 1 | | Fromage Cottage | Sealtest | 125 | 100 | 15=20 | 8 | 1 | | Ficello | Black Diamond | 21 | 60=20 | 6 | 0 | 4 | | Concombre cru | | 100 | 15 | 0.65=20 | 3.63 | 0.11 | | Clementine cru | | 100 | 47 | 0.85=20 | 12.02 | 0.15 | In the table 2, I would like to be able to just set a column to ie. 2=20 (for "Poitrine Poulet"), then I'll be able to get all the info of the=20 different columns I need to do my calculs. I see there is also a "_"=20 option for row name, but I'm unsure on how to specify the column desired=20 with that name and how to get it evaluated if I need to concat something.= .. regards, Alan S=C3=A9bastien Vauban wrote: > Hi Alan, > > Alan Boudreault wrote: > =20 >> Here's what I'm trying to do (without success) in my spreadsheet: >> >> I have a first table : >> >> #+TBLNAME: table1 >> | ... |... |.... |...|... >> >> and a second table: >> >> #+TBLNAME: table2 >> | line_reference | ... |... |.... |...|... >> >> The line_reference is the line number to get some information in the t= able1. >> So in a cell of the table2, I tried a formula like: remote(table1,@$1$= 3) ($1 >> =3D the line_reference) which of course, didn't work. >> >> then I tried to use elisp: remote(table1,'(concat "@" $1 "$3")') .... = but no >> success anyway. >> >> after all, I decided to merge my 2 tables because it looks like I can = use >> elisp inside a org function (remote). The last tried formula was: '(co= ncat >> "@" $1 "$3")' ,($1 =3D the line_reference). The problem of this formul= a is >> only that I got the string "@2$3" inside the cell and it's not evaluat= ed as >> a formula. >> >> Could anyone give me some hint to get done what I'm trying to do? >> =20 > > What I do, which works: > > - give a name to the cell in table1 > - reference it (in table2) by its name > > > #+TBLNAME: Eau > | | Date | Relev=C3=A9 m3 | Consommation | Prix TVAC | > |---+------------------+-----------+--------------+-----------| > | | [2009-11-15 Sun] | 2072.6263 | 0.0000 | 0.00 | > | | [2009-11-22 Sun] | 2074.1774 | 1.5511 | 1.55 | > | | [2009-11-29 Sun] | 2076.0834 | 1.9060 | 1.91 | > | | [2009-12-06 Sun] | 2077.6757 | 1.5923 | 1.59 | > | | [2009-12-13 Sun] | 2079.2140 | 1.5383 | 1.54 | > | | [2009-12-20 Sun] | 2081.4222 | 2.2082 | 2.21 | > | | [2009-12-27 Sun] | 2083.2146 | 1.7924 | 1.79 | > | | [2010-01-03 Sun] | 2085.4916 | 2.2770 | 2.28 | > | | [2010-01-10 Sun] | 2087.4283 | 1.9367 | 1.94 | > | ^ | | | | Eau | > #+TBLFM: $4=3D@+0$-1-@-1$-1;%.4f::$5=3D$4*1;%.2f::@2$4=3D0;%.4f > > > | =C3=89nergie | Prix TVAC | > |-------------+-----------| > | Eau | 1.94 | > | Gaz | 156.81 | > | =C3=89lectricit=C3=A9 | 11.64 | > |-------------+-----------| > | Total | 170.39 | > #+TBLFM: @2$2=3Dremote(Eau,$Eau)::@3$2=3Dremote(Gaz,$Gaz)::@4$2=3Drem= ote(Elec,$Elec)::@5$2=3Dvsum(@-I..@-II);%.2f > > Best regards, > Seb > > =20 --=20 Alan Boudreault Mapgears http://www.mapgears.com/=20