emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Newbie Questions on Spreadsheets
@ 2022-05-19  2:13 Jun Inoue
  2022-05-19 13:45 ` Quiliro Ordóñez
  0 siblings, 1 reply; 4+ messages in thread
From: Jun Inoue @ 2022-05-19  2:13 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-20  0:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19  2:13 Newbie Questions on Spreadsheets Jun Inoue
2022-05-19 13:45 ` Quiliro Ordóñez
2022-05-19 23:14   ` Jun Inoue
2022-05-20  0:37     ` Quiliro Ordóñez

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).