From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: How to do a sum of products in a table? Date: Fri, 14 Jun 2013 20:53:04 +0200 Message-ID: References: <87mwqs7mjv.fsf@pank.home> <87y5ac61gn.fsf@pank.home> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnZ7V-0005rT-5I for emacs-orgmode@gnu.org; Fri, 14 Jun 2013 14:53:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UnZ7T-0006nb-Nz for emacs-orgmode@gnu.org; Fri, 14 Jun 2013 14:53:09 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:37885) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnZ7T-0006nO-HY for emacs-orgmode@gnu.org; Fri, 14 Jun 2013 14:53:07 -0400 In-reply-to: <87y5ac61gn.fsf@pank.home> 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: Rasmus Cc: emacs-orgmode@gnu.org Rasmus writes: > So perhaps you'd want something like this > > | | Name | Grade | Question 1 | Question 2 | Question 3 | > | ! | | grade | q1 | | q3 | > | _ | | g | | | | > | / | Coeff | 6 | 1 | 3 | 2 | > |---+-----------+-----------+------------+------------+------------| > | * | Foo | 6.67 | 1/2 | 1 | 1/4 | > | * | Bar | 6.67 | 1 | 1 | 0 | > | * | Baz | 7.5 | 1 | 3/2 | -1/2 | > |---+-----------+-----------+------------+------------+------------| > | _ | | mean | | max | | > | | Mean | 6.9444445 | std.dev. | 0.48112521 | | > | $ | Constants | magic=10 | | | | > |---+-----------+-----------+------------+------------+------------| > #+TBLFM: $g=vsum($q1..$q3):: $3=round(@I-1$q1..@I-1$q3*$q1..$q3*$magic/$g,2):: > #+TBLFM: $mean=vmean(@I$grade..II$grade)::$max=vsdev(@I$grade..II$grade) > > It even exports pretty tables so you could hardly wish for more. Thanks, this is great! I had no idea multiplying ranges would do the right thing. Thanks again, Alan