emacs-orgmode
[Top][All Lists]
Advanced

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

[O] 2 questions on tables


From: Andreas Leha
Subject: [O] 2 questions on tables
Date: Mon, 15 Jul 2013 08:47:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi all,

I have two questions concerning tables in orgmode:

1. What is the best way to handle missing values?
   I have the problem, that missing values ("") are treated as "0" when they
   appear in a formula.
   Entering ("nil") instead helps a bit, but does not propagate,
   i.e. nil + 1 results in 0.
   Can I do better?
2. What is the best way to drop a column while preserving the number of
   digits displayed?
   I use a simple code block to drop the columns.  But I do not see how
   to prevent orgmode from dropping trailing 0s

Here is an example demonstrating both questions:
--8<---------------cut here---------------start------------->8---
#+TITLE: Drop columns

* Create Some Table with a Missing Value
#+name: mytable
| Item      | Price ($) | Price ($+1) |
|-----------+-----------+-------------|
| Apple     |     10.55 |       11.55 |
| Tomato II |       nil |        0.00 |
| Tomato    |           |        1.00 |
| Pear      |      3.00 |        4.00 |
| Monkey    |    100.55 |      101.55 |
|-----------+-----------+-------------|
| Sum       |     10.55 |      118.10 |
#+TBLFM: 
$3=$2+1;%.2f::@7$2=vsum(@address@hidden);%.2f::@7$3=vsum(@address@hidden);%.2f


* Drop a Column
#+name: mysmalltable
#+begin_src emacs-lisp :var input=mytable[,0:1] :exports results
  input
#+end_src

#+results: mysmalltable
| Item   | Price ($) |
|--------+-----------|
| Apple  |     10.55 |
| Tomato |           |
| Pear   |       3.0 |
| Monkey |    100.55 |
--8<---------------cut here---------------end--------------->8---

Regards,
Andreas




reply via email to

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