Hi

Consider please
#+begin_src emacs-lisp :results silent :exports none
| Name  | Theory | Matlab | Exercises | Result |
|-------+--------+--------+-----------+--------|
| User1 |      5 |      2 |         1 | 8      |
| User2 |        |      2 |         1 | NP     |
| User3 |      4 |      1 |           | NP     |
,#+TBLFM: $5=if(typeof(vsum($2..$4)) == 12 , string("NP"),vsum($2..$4)); E f-1
#+end_src

Each cell in a row that is empty results in the string NP, so far so good.
Now I want to achieve the same but only if cells in the second column are 
empty. So I thought 

#+begin_src emacs-lisp :results silent :exports none
| Name  | Theory | Matlab | Exercises | Result |
|-------+--------+--------+----------+-------|
| User1 |      5 |      2 |        1 |     8 |
| User2 |        |      2 |        1 |    NP |
| User3 |      4 |      1 |        0 |     5 |
#+TBLFM: $5=if("$2" == "nan", string("NP"),vsum($2..$4)); E f-1
#+end_src

That looks ok, however when say a cell in the third column is empty, the 
problem starts
because it results in 
#+begin_src emacs-lisp :results silent :exports none
| Name  | Theory | Matlab | Exercises | Result |
|-------+--------+--------+-----------+--------|
| User1 |      5 |      2 |         1 |      8 |
| User2 |        |      2 |         1 |     NP |
| User3 |      4 |      1 |           |    nan |
,#+TBLFM: $5=if("$2" == "nan", string("NP"),vsum($2..$4)); E f-1
#+end_src

Any idea how to solve this problem (I don't know how to have several ifs in 
such expression)

regards

Uwe Brauer 

   


Reply via email to