From mboxrd@z Thu Jan 1 00:00:00 1970 From: Karl Voit Subject: Help on spreadsheet/calc references and improvements Date: Sat, 5 Oct 2013 16:49:24 +0200 Message-ID: <2013-10-05T16-39-57@devnull.Karl-Voit.at> Reply-To: news1142@Karl-Voit.at Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSTAz-0006Yr-0D for emacs-orgmode@gnu.org; Sat, 05 Oct 2013 10:49:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSTAt-0001Xo-SJ for emacs-orgmode@gnu.org; Sat, 05 Oct 2013 10:49:48 -0400 Received: from plane.gmane.org ([80.91.229.3]:46148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSTAt-0001Xg-LD for emacs-orgmode@gnu.org; Sat, 05 Oct 2013 10:49:43 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VSTAr-0006Ky-Si for emacs-orgmode@gnu.org; Sat, 05 Oct 2013 16:49:41 +0200 Received: from mail.michael-prokop.at ([88.198.6.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 05 Oct 2013 16:49:41 +0200 Received: from news1142 by mail.michael-prokop.at with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 05 Oct 2013 16:49:41 +0200 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: emacs-orgmode@gnu.org 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