[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] problem with empty column
From: |
Uwe Brauer |
Subject: |
Re: [O] problem with empty column |
Date: |
Fri, 05 Jan 2018 13:44:52 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
"Eric" == Eric S Fraga <address@hidden> writes:
> On Friday, 5 Jan 2018 at 09:28, Uwe Brauer wrote: [...]
>> The last row behaves strangely the cell in the second
>> column is *not* empty but the cell in the third one is,
>> nevertheless the cell in the last column contains the
>> string nan, which I don't understand.
> But the second column is *not* empty; maybe you meant 3rd
> column?
What I meant is this.
Take the following simple table
| Name | E1 | E2 | E3 | E4 | Res |
|--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 |
|| Entry2 | 10 | 20 | 30 | 40 | | #+TBLFM: $6=($2+$3+$4+$5)/10
C-u C-u C-c C-c
leads to
| Name | E1 | E2 | E3 | E4 | Res |
|--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 |
|13 | Entry2 | 10 | 20 | 30 | 40 | 10 | #+TBLFM:
|$6=($2+$3+$4+$5)/10
Now for any new entry I want to have in the 6th column NP if the
entry in the second column (not the whole column) is empty.
| Name | E1 | E2 | E3 | E4 | Res |
|--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 |
|13 | Entry2 | 10 | 20 | 30 | 40 | 10 | Entry3 | | | |
|| |
Should lead to
| Name | E1 | E2 | E3 | E4 | Res |
|--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 |
|13 | Entry2 | 10 | 20 | 30 | 40 | 10 | Entry3 | | | |
|| NP |
How can I achieve that?
The following works well
| Name | E1 | E2 | E3 | E4 | Res |
|--------+----+----+----+----+-----| Entry1 | | | | |
|NP | Entry2 | 10 | 20 | 30 | 40 | 10 | #+TBLFM: $6=if("$2" ==
|"nan" , string("NP"),($2+$3+$4+$5)/10);E
although the second column is *not* empty, but it is empty for
Entry 1.
But fails if there is a row like this
| Name | E1 | E2 | E3 | E4 | Res |
|--------+----+----+----+----+-----| Entry1 | | | | |
|NP | Entry2 | 10 | 20 | 30 | 40 | 10 | Entry3 | 10 | | 20 |
|30 | nan | #+TBLFM: $6=if("$2" == "nan" ,
|string("NP"),($2+$3+$4+$5)/10);E
Uwe