emacs-orgmode
[Top][All Lists]
Advanced

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

Newbie Questions on Spreadsheets


From: Jun Inoue
Subject: Newbie Questions on Spreadsheets
Date: Thu, 19 May 2022 11:13:29 +0900

Hi!  I've recently started using org mode, and have loved pretty much every step of it.  Thanks for all your work!

I just discovered the power of tables and spreadsheets and started toying around with it, but there are a few things I can't get to work the way I want.  Would someone please help me out, or tell me if I'm trying to use it wrong?

1. How do you apply a column formula?

The info manual mentions C-u C-c *, but this doesn't always work.  For example, I have

| $ |      |   |
|   | 2.80 |   |
|   | 5.53 |   |
#+TBLFM: $3=$2

and typing C-u C-c * inside the table changes nothing.  If I remove the $ cell the C-u C-c * does update the whole table, so could it be a bug in the handling of $?

2. Is there a way to move/delete columns and rows without screwing up formulas?

While minimizing the example above, I deleted a bunch of columns from a larger table using org-table-delete-column, only to find that the formulas are not updated, so they become dangling references or reference the wrong columns.  Same for rows, or moving them with e.g. org-metadown.  Is there a way to have the formulas update as I restructure the table?

3. Formatting directives seem to take the numerators of rationals.

For example, if I hit C-c C-c in

| 5:6 | :=@1$1;%.2f |

I get

| 5:6 | 5.00 |
#+TBLFM: @1$2=@1$1;%.2f

whereas I would have expected the last column to be 0.17.  It seems that %f directives take the numerators of ratios, but I would have expected it to coerce to the closest floating point instead.  (It doesn't make sense to me: when would you /want/ to drop the denominator?)  I know I can coerce manually with float(), but counting on myself to insert that every time sounds like a mistake waiting to happen.

Is there a way to customize it so that ratios are converted to float by the %f directive, rather than having its denominator thrown away?

4. Is there a way to combine concise display with high-precision calculations?

I prefer floating point to be formatted concisely, like %.2f, to avoid visual clutter and to keep column sizes manageable (especially since I use visual-line-mode).  But if I put %.2f everywhere, I quickly run into precision issues.  For example:

| :=2/3;%.2f | := @1$1+@1$1 | :=@1$2 + @1$2 + @1$2 |

Evaluating these formulas gives

| 0.67 | 1.34 | 4.02 |
#+TBLFM: @1$1=2/3;%.2f::@1$2=@1$1+@1$1::@1$3=@1$2 + @1$2 + @1$2

The calculation is cut off at two decimal places.  Full-blown spreadsheet software usually separates the internal data representation from the formatting, so that formatting doesn't affect precision.  Is there a way to achieve a similar effect, or is that difficult given how org-mode tables keep all the data as explicit text?

BTW, I'm using Org mode 9.5.2 with Emacs 28.1 on macOS (so-called Mitsuharu's mac-port).


--
Jun Inoue

reply via email to

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