emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Juan <Pechiar@computer.org>
To: Neil Hepburn <nhepburn@ualberta.ca>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: lookup functions in spreadsheet/table
Date: Fri, 30 Jul 2010 19:29:26 -0300	[thread overview]
Message-ID: <20100730222926.GS5569@soloJazz.com> (raw)
In-Reply-To: <460AB3C0-8E5C-403F-AC3A-147357C46306@ualberta.ca>

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(<target>,<lookup range>,<column to return>). 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.

      reply	other threads:[~2010-07-30 22:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-30 21:06 lookup functions in spreadsheet/table Neil Hepburn
2010-07-30 22:29 ` Juan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100730222926.GS5569@soloJazz.com \
    --to=pechiar@computer.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=nhepburn@ualberta.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).