emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: Re: org-table and formulas
Date: Wed, 13 Jan 2010 11:23:34 +0100	[thread overview]
Message-ID: <87y6k2gv6h.fsf@mundaneum.com> (raw)
In-Reply-To: 4B4B7CD5.80907@mapgears.com

Hi Alan,

Alan Boudreault wrote:
>
> 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 table1.
> So in a cell of the table2, I tried a formula like: remote(table1,@$1$3) ($1
> = 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: '(concat
> "@" $1 "$3")' ,($1 = the line_reference). The problem of this formula is
> only that I got the string "@2$3" inside the cell and it's not evaluated as
> a formula.
>
> Could anyone give me some hint to get done what I'm trying to do?

What I do, which works:

- give a name to the cell in table1
- reference it (in table2) by its name


  #+TBLNAME: Eau
  |   | Date             | Relevé 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=@+0$-1-@-1$-1;%.4f::$5=$4*1;%.2f::@2$4=0;%.4f


  | Énergie     | Prix TVAC |
  |-------------+-----------|
  | Eau         |      1.94 |
  | Gaz         |    156.81 |
  | Électricité |     11.64 |
  |-------------+-----------|
  | Total       |    170.39 |
  #+TBLFM: @2$2=remote(Eau,$Eau)::@3$2=remote(Gaz,$Gaz)::@4$2=remote(Elec,$Elec)::@5$2=vsum(@-I..@-II);%.2f

Best regards,
  Seb

-- 
Sébastien Vauban



_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-01-13 10:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-11 19:32 org-table and formulas Alan Boudreault
2010-01-13 10:23 ` Sébastien Vauban [this message]
2010-01-13 11:14   ` Alan Boudreault
2010-01-13 11:56     ` Stephan Schmitt
2010-01-13 11:59     ` Carsten Dominik
2010-01-13 12:23       ` Alan Boudreault

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=87y6k2gv6h.fsf@mundaneum.com \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
    /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).