From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juan Subject: Re: lookup functions in spreadsheet/table Date: Fri, 30 Jul 2010 19:29:26 -0300 Message-ID: <20100730222926.GS5569@soloJazz.com> References: <460AB3C0-8E5C-403F-AC3A-147357C46306@ualberta.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=34540 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oey5A-00016m-Tj for emacs-orgmode@gnu.org; Fri, 30 Jul 2010 18:29:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oey59-0000MT-MP for emacs-orgmode@gnu.org; Fri, 30 Jul 2010 18:29:36 -0400 Received: from cpoproxy3-pub.bluehost.com ([67.222.54.6]:37046) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1Oey59-0000M0-AS for emacs-orgmode@gnu.org; Fri, 30 Jul 2010 18:29:35 -0400 Content-Disposition: inline In-Reply-To: <460AB3C0-8E5C-403F-AC3A-147357C46306@ualberta.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Neil Hepburn Cc: emacs-orgmode Hi Neil, One possible solution is to have a babel block defining an elisp function for note to grade transformation, and then using that function in your table. Something like this (partly tested): #+begin_src emacs-lisp (defun grade (x) (cond ( (< x 20) "C") ( (< x 50) "B") ( t "A") )) #+end_src | 1 | C | | 22 | B | | 44 | B | | 77 | A | #+TBLFM: $2='(grade $1);N This way you get notes and grades in a single table. If you need a separate table with just names and grades (no notes) then probably babel is the way to go to explicitly process the table and generate a new one. Hope it helps. Regards, .j. On Fri, Jul 30, 2010 at 03:06:49PM -0600, Neil Hepburn wrote: > I am looking for a lookup function for tables in org-mode. In the > past I have used a spreadsheet to keep track of student grades and > then had a table that contained cut points and grades. Assigning > grades was simple because the formula would simply look up the > student's grade in the cut points table and assign the appropriate > letter grade. In Yicksel, also known as Excel, the function would be > =vlookup(,,). If I need to > "tweak" my grade distribution to satisfy an anal retentive Registrar > type, I can do so by altering the cut points. Now that I am using > org-mode and emacs for everything else, thought it would be > interesting to keep my grade book in it too.