emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jun Inoue <jun.lambda@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Newbie Questions on Spreadsheets
Date: Thu, 19 May 2022 11:13:29 +0900	[thread overview]
Message-ID: <CA+ZA8Qz3SK2WReQtCO9DPa_trXpV-_rk1pdiMB0WoDc9avJqeA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2805 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3142 bytes --]

             reply	other threads:[~2022-05-19  2:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19  2:13 Jun Inoue [this message]
2022-05-19 13:45 ` Newbie Questions on Spreadsheets Quiliro Ordóñez
2022-05-19 23:14   ` Jun Inoue
2022-05-20  0:37     ` Quiliro Ordóñez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+ZA8Qz3SK2WReQtCO9DPa_trXpV-_rk1pdiMB0WoDc9avJqeA@mail.gmail.com \
    --to=jun.lambda@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).