From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: table formula help... Date: Sat, 06 Dec 2014 13:42:52 +0800 Message-ID: <87ppbxfi5f.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx83m-000539-H5 for emacs-orgmode@gnu.org; Sat, 06 Dec 2014 00:37:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xx83e-0007im-PH for emacs-orgmode@gnu.org; Sat, 06 Dec 2014 00:37:38 -0500 Received: from plane.gmane.org ([80.91.229.3]:54489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx83e-0007ia-IF for emacs-orgmode@gnu.org; Sat, 06 Dec 2014 00:37:30 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Xx83Y-0001pL-D1 for emacs-orgmode@gnu.org; Sat, 06 Dec 2014 06:37:24 +0100 Received: from 61.149.185.27 ([61.149.185.27]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 06 Dec 2014 06:37:24 +0100 Received: from eric by 61.149.185.27 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 06 Dec 2014 06:37:24 +0100 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 I never seem to use the spreadsheet unless it's some horribly complicated thing I don't know how to calculate... Can someone lend me a hand? I'm calculating payment rates for contributors (actually translators) to a magazine. I've got two tables: The first is essentially a table of contents, listing pieces with their character count (prose), or line count (poetry), plus who translated it. The second is a list of translators, with their total character/line count, and how much they're owed. I'm having a hell of a time getting the column formulas right: specifically referencing one table from another. The first table looks like this: #+NAME: counts | Piece | Chars | Lines | Translator | +----------------+--------+-------+------------------+ | 凤凰 | | 84 | Austin Woerner | | 王血 | 6633 | | Eric Abrahamsen | | 赵氏孤儿 | 16984 | | Canaan Morse | | 山鬼故家 | | 24 | Lucas Klein | | 寂静何其深沉 | | 10 | Lucas Klein | And the second: #+NAME: payments #+CONSTANTS: prose=0.7 poetry=10 | Translator | Total Chars | Total Lines | Payment | |------------------+-------------+-------------+---------| | Austin Woerner | | | | | Eric Abrahamsen | | | | | Canaan Morse | | | | | Lucas Klein | | | | In this second table, the formula I want for the "Total Chars" column is: "Set each row of $2 in table payments to the sum of all numbers in $2 of remote(counts), if $2 is not empty, and if $4 of remote(counts) is equal to $1 of table payments." The formula for "Total Lines" would be exactly the same, but with the $2s all switched to $3. I can handle adding up the amounts! Is it possible to iterate over all the rows in another table like this? Is there a better way I could be arranging my tables? Thanks for any tips! Eric