Search code examples
org-mode

Count elements in a org-mode table


NOI have an org-mode table with forth column containing only the words YES or NO

I would like to count how many Nos I have. I have little experience with calc, so from googling I got the following try:

#+TBLFM: @>$4=vcount(map(<if(eq($4,'NO'), 1, [])>, @I..@II))

which does not work. Thank for any help!


Solution

  • I have no experience with calc, so I will use lisp instead (I am not skilled either though). I think this should work:

    #+TBLFM: @>$4='(apply '+ (mapcar (lambda (x) (if (string= "YES" x) 1 0)) '(@I$4..@II$4)))
    

    Regarding your function, try to quote "$4" and use the string function eq("$4",string("NO") cf orgmode manual

    Hope it helps.