From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: How to do a sum of products in a table? Date: Fri, 14 Jun 2013 17:13:24 +0200 Message-ID: <87mwqs7mjv.fsf@pank.home> References: 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]:39691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnVh8-0005Vq-TS for emacs-orgmode@gnu.org; Fri, 14 Jun 2013 11:13:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UnVh6-00054x-7R for emacs-orgmode@gnu.org; Fri, 14 Jun 2013 11:13:42 -0400 Received: from plane.gmane.org ([80.91.229.3]:41555) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnVh6-00054e-1O for emacs-orgmode@gnu.org; Fri, 14 Jun 2013 11:13:40 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UnVh3-0001Ij-55 for emacs-orgmode@gnu.org; Fri, 14 Jun 2013 17:13:37 +0200 Received: from business-213-023-238-209.static.arcor-ip.net ([213.23.238.209]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 14 Jun 2013 17:13:37 +0200 Received: from rasmus by business-213-023-238-209.static.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 14 Jun 2013 17:13:37 +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 Alan, > I'm grading an exam, and I'm trying to use org instead of Numbers to > tabulate the results. For each student, I'll input how well he answered > to the question, and his grade will be (sum of mark * coefficient), > where each question has a different coefficient (in Numbers I was using > the SUMPRODUCT function). > > Is there a way to do this in org mode? Sure, but please provide an example. E.g. is each student a column? Or is the dotproduct of two vectors where mark is just one Here's a prtty simple example | | nr. | score | score | |---+-----+-----------+-------| | # | 1 | [1, 2, 3] | 4.2 | | # | 2 | [3, 4, 5] | 7.8 | #+TBLFM: $4=$3*[.3, .6, .9] It would probably be nicer to have the weighting matrix externally defined. Perhaps you can use #+CONSTANTS or the remote function. If you prefer you can also let each A more advance example is given in the manual: http://orgmode.org/org.html#Advanced-features |---+---------+--------+--------+--------+-------+------| | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note | |---+---------+--------+--------+--------+-------+------| | ! | | P1 | P2 | P3 | Tot | | | # | Maximum | 10 | 15 | 25 | 50 | 10.0 | | ^ | | m1 | m2 | m3 | mt | | |---+---------+--------+--------+--------+-------+------| | # | Peter | 10 | 8 | 23 | 41 | 8.2 | | # | Sam | 2 | 4 | 3 | 9 | 1.8 | |---+---------+--------+--------+--------+-------+------| | | Average | | | | 25.0 | | | ^ | | | | | at | | | $ | max=50 | | | | | | |---+---------+--------+--------+--------+-------+------| #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@-II..@-I);%.1f Refer to http://orgmode.org/org.html#The-spreadsheet –Rasmus -- Hooray!