emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: evaluating rows or columns in org-table


From: Gabriel Peters
Subject: Re: [Orgmode] Re: evaluating rows or columns in org-table
Date: Wed, 30 Jul 2008 10:49:48 -0700



On Wed, Jul 30, 2008 at 9:16 AM, Bernt Hansen <address@hidden> wrote:
Sorry that last post was unfinished.

Here's my attempt at fixing the student rank

|   | Rank | names      | grade 1 | grade 2 | grade 3 | Total | Letter grade |
|---+------+------------+---------+---------+---------+-------+--------------|
| # |    1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | A            |
| # |    3 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | A            |
| # |    2 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | A            |
| # |    4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | B            |
#+TBLFM: $7=($4+$5+$6)/3;%.2f::$8=if($7<60,F,if($7<70,D,if($7<80,C,if($7<90,B,A))))::@2$2=1::address@hidden

You can sort the table by the total column descending to get the rank.

If you sort the resulting table like this:

 1) Position cursor on any total value
 2) M-x org-table-sort-lines
 3) N (for reverse numeric sort)

Then update the Rank column with C-u C-u C-c C-c anywhere in the table
the rank numbers are recomputed starting from 1 on the first row.

I hope your blank lines aren't too important because sorting puts them
all at the bottom of the table.


The blank lines do also pose a problem in different approach, one which will make use of vector functions in calc. If you allow for no empty lines and one extra line toward the end of table, this also can do the computation.
 

|   | Rank | names      | grade 1 | grade 2 | grade 3 | Total | Letter grade |
|---+------+------------+---------+---------+---------+-------+--------------|
| # |    1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | A            |
| # |    2 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | A            |
| # |    3 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | A            |
| # |    4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | B            |
|---+------+------------+---------+---------+---------+-------+--------------|
#+TBLFM: $2=find(rsort(@address@hidden),$7)::$7=($4+$5+$6)/3;%.2f::$8=if($7<60,F,if($7<70,D,if($7<80,C,if($7<90,B,A))))




Does that do what you want?

-Bernt


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


reply via email to

[Prev in Thread] Current Thread [Next in Thread]