emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Karl Voit <devnull@Karl-Voit.at>
To: emacs-orgmode@gnu.org
Subject: Help on spreadsheet/calc references and improvements
Date: Sat, 5 Oct 2013 16:49:24 +0200	[thread overview]
Message-ID: <2013-10-05T16-39-57@devnull.Karl-Voit.at> (raw)

Hi!

I am no expert with calc. I enjoy using it for rather
simple things. However, I would like to use referencing more often
and I face an issue here.

Additionally, I got the feeling that some formulas could be improved
as well.

I did a very basic example in two ways: vertical layout and
horizontal layout. The reason for this is, that I got the feeling
that referencing a set of values (not a single cell) differs in
capabilities from rows to columns.

- possible improvements
  - remote reference to multiple cells
  - only one formula for summing up the columns or rows
  - simpler referencing in general?

Headings ending with a plus sign are rows/columns that ought to be
entered manually (as a basis). Others should get calculated or
filled using references. I hope the example is self-explanatory.

Names ending with "-WIST" are tables I would like to get using
formulas. Names ending with "-TRY" are draft versions that
demonstrate referencing issues. Further TBLFM below the TRY versions
contain other attempts.

Feel free to make suggestions how to overcome my lack of knowledge
:-)

Thanks!


#+NAME: Data23vert
| Descr+ | Data1+ | Data2+ |
|--------+--------+--------|
| foo    |     12 |     10 |
| bar    |     22 |     24 |
| baz    |     16 |     17 |
|--------+--------+--------|
| sum    |     50 |     51 |

#+NAME: Calc23vert-WISH
| Descr | Data2 | Double  |
|-------+-------+---------|
| foo   |    10 |      20 |
| bar   |    24 |      48 |
| baz   |    17 |      34 |
|-------+-------+---------|
| sum   |    51 |     102 |
#+TBLFM: FIXXME

#+NAME: Calc23vert-TRY
| Descr | Data2 | Double  |
|-------+-------+---------|
| foo   |    24 |      48 |
| bar   |    24 |      48 |
| baz   |    24 |      48 |
|-------+-------+---------|
| sum   |    72 |     144 |
#+TBLFM: @I$2..@II$2=subscr(remote(Data23vert, @I$>..@II$>), $#)::@I$3..@II$3=$2*2::@5$2=vsum(@I$2..@II$2)::@5$3=vsum(@I$3..@II$3)

#+TBLFM: @I$2..@II$2 = subscr(remote(Data23vert, @I$>..@II$>), $#) 
... results in 24 in each field

(btw, I got the subscr() trick here in the ML but I have to admit
that [1] did not lead to a understanding of it.)

#+TBLFM: @I$2..@II$2 = remote(Data23vert, @I$>..@II$>)
... results in list in each field



#+NAME: Data23horiz
| Descr+ | foo | bar | baz | sum |
|--------+-----+-----+-----+-----|
| Data1+ |  12 |  22 |  16 |  50 |
| Data2+ |  10 |  24 |  17 |  51 |

#+NAME: Calc23horiz-WISH
| Descr   | foo | bar | baz | sum |
|---------+-----+-----+-----+-----|
| Data2   |  10 |  24 |  17 |  51 |
| Double  |  20 |  48 |  34 | 102 |
#+TBLFM: FIXXME

#+NAME: Calc23horiz-TRY
| Descr   | foo          | bar          | baz          | sum |
|---------+--------------+--------------+--------------+-----|
| Data2   | [10, 24, 17] | [10, 24, 17] | [10, 24, 17] |     |
| Double  |              |              |              |     |
#+TBLFM: @2$2..@2$4=remote(Data23horiz, @>$2..@>$4)

#+TBLFM: @2$2..@2$4=subscr(remote(Data23horiz, @>$2..@>$4), $#) 
... 24, 17, list -> WTF?

#+TBLFM: @2$2..@2$4=remote(Data23horiz, @>$2..@>$4)
... three identical lists instead of values

  1. https://www.gnu.org/software/emacs/manual/html_node/calc/Extracting-Elements.html
-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

             reply	other threads:[~2013-10-05 14:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-05 14:49 Karl Voit [this message]
2013-10-05 15:16 ` Help on spreadsheet/calc references and improvements Michael Brand
2013-10-05 16:08   ` Karl Voit
2013-10-05 16:44     ` Michael Brand
2013-10-06 11:30 ` Karl Voit
2013-10-06 17:03   ` Michael Brand
2013-10-06 18:31     ` Karl Voit
2013-10-06 19:38       ` Michael Brand
2013-10-06 20:06         ` Karl Voit
2013-10-06 20:51           ` Michael Brand
2013-10-18 19:07     ` Michael Brand
2013-10-23 15:12       ` Michael Brand
2013-10-24  6:18         ` Carsten Dominik
2013-10-24 20:47           ` Michael Brand
2013-10-25 10:56             ` Nicolas Goaziou
2013-10-25 13:30               ` Carsten Dominik
2013-10-25 17:03                 ` Nicolas Goaziou
2013-10-25 13:31             ` Carsten Dominik
2013-10-30 17:59               ` Michael Brand
2013-11-13 17:27                 ` Michael Brand
2013-11-13 17:34                   ` Bastien
2013-11-13 19:42                     ` Michael Brand
2013-11-13 23:21                       ` Bastien

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=2013-10-05T16-39-57@devnull.Karl-Voit.at \
    --to=devnull@karl-voit.at \
    --cc=emacs-orgmode@gnu.org \
    --cc=news1142@Karl-Voit.at \
    /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).