On Mon, Apr 8, 2013 at 10:21 PM, Gunnar Wolf <[email protected]> wrote:
> Suvayu Ali dijo [Tue, Apr 09, 2013 at 02:25:19AM +0200]:
> > On Mon, Apr 08, 2013 at 06:57:53PM -0500, Gunnar Wolf wrote:
> > > #+CAPTION: Attendances for April
> > > |---------+-------------------+---+---+---+---+----+-------|
> > > | Account | Name | 1 | 3 | 5 | 8 | 10 | Total |
> > > |---------+-------------------+---+---+---+---+----+-------|
> > > | 1234 | Cárdenas, Lázaro | X | | X | X | | 3 |
> > > | 5678 | Madero, Francisco | X | X | X | X | | 4 |
> > > | 1544 | Villa, Pancho | | | | | | 1 |
> > > | 0113 | Zapata, Emiliano | | X | X | | | 2 |
> > > |---------+-------------------+---+---+---+---+----+-------|
> > > | Day avg | 2.25 | 2 | 2 | 3 | 2 | 1 | 2.50 |
> > > |---------+-------------------+---+---+---+---+----+-------|
> > > #+tblfm: @2$8..@5$8='(length '($3..$7))::@6$2=vmean($3..$7);%.2f::@6
> $3..@6$7='(length '(@2..@5))::@6$8=vmean(@2..@5);%.2f
> >
> > Probably not what you were looking for, why complicate things by using
> > Xs instead of just a numeral like 1? If you use 1, then you can use a
> > column formula; maybe something like $>=sum($3..$-1).
>
> I had though about it, and it's currently a last resort for me. I want
> to publish the lists in the course's webpage, and while a '1' would do
> for me, I'd rather present to the students something they are more
> likely to understand as natural.
>
>
You can turn on formula debugging with C-c { and then you'd
see that in Pancho's case, the list is ("") i.e. a list containing the
empty string - a list of length 1. That might qualify as a bug (or not) but
you can easily work around it, using (delq "" list) which deletes empty
strings from the list.
Try this:
#+CAPTION: Attendances for April
|---------+-------------------+---+---+---+---+----+-------|
| Account | Name | 1 | 3 | 5 | 8 | 10 | Total |
|---------+-------------------+---+---+---+---+----+-------|
| 1234 | Cárdenas, Lázaro | X | | X | X | | 3 |
| 5678 | Madero, Francisco | X | X | X | X | | 4 |
| 1544 | Villa, Pancho | | | | | | 0 |
| 0113 | Zapata, Emiliano | | X | X | | | 2 |
|---------+-------------------+---+---+---+---+----+-------|
#+tblfm: @II+1$>..@III-1$>='(length (delq "" '($<<<..$>>)))
I kept just one formula for clarity. I also tried to avoid absolute
row and column numbers (the $3 seemed better than $<<< though
so I kept it)
: @II is the second separator, $> is the last column
and $>> is the penultimate column.
HTH,
Nick