Skip to main content
22 votes
Accepted

Can I format cells in an org-mode table differently depending on a formula?

I got whole-table formatting to work with some Elisp: A formula is evaluated for the cells' contents, and converted to a color using a gradient. Org file including code: #+name: item-prices |-------...
Vladimir Panteleev's user avatar
8 votes

Make org-mode table formulas use common arithmetic precedence

You can just use another language for calc-eval in orgmode by the following setting in your init file. (setq org-calc-default-modes (append '(calc-language c) org-calc-default-modes)) You can also ...
Tobias's user avatar
  • 33.3k
5 votes
Accepted

Org table spreadsheet recalculate all TBLFM lines

As of org-mode 9 you can only do this manually: Place the cursor on the respective #+tblfm: lines and press C-c C-c. Here's the corresponding manual section, which is telling you that org considers ...
Dieter.Wilhelm's user avatar
5 votes

Can I format cells in an org-mode table differently depending on a formula?

Emacs provides the function hi-lock-face-buffer M-s h rwhich highlights a regular expression in the buffer as you type. All we need is a regular expression which matches any number which is not 1 or ...
Rip Torn's user avatar
4 votes

Number-separators in org-mode tables

Just use a little lisp to transform the cell string to a valid number. You can use a lisp form as cell formula if you start the formula with apostrophe and parenthesis '(. Org-table cell references ...
Tobias's user avatar
  • 33.3k
3 votes
Accepted

In org-mode, can I show the formula of the table cell at point in eldoc?

I'd like C-c ? to happen automatically when I focus on a table cell, is there something built-in to do this? To get this Display Table Cell info as eldoc string on this #+NAME: table1 #+CAPTION: ...
mxnt's user avatar
  • 696
3 votes
Accepted

Org mode: Simple "if" formula on my table throws an error

I don't know well the formula syntax for calc, but it seems that if you follow exactly the syntax of string constant that the documentation uses, it will work. Namely, replace '' by "": #+...
Firmin Martin's user avatar
3 votes
Accepted

Recalculate All Org-Mode Tables at Once Ending with Summary Table

The easiest, but not necessarily the most efficient way to do that, is to use org-table-iterate-buffer-tables: that will try updating all the tables until there is no change in the buffer. I would add ...
NickD's user avatar
  • 30.9k
3 votes
Accepted

Org mode: How to escape the # character in a table formula

The following works because you can write table formulas with elisp code. Notice the ' (quote) before the s-exp. | # | B | C | |---+---+---| | 1 | 2 | 3 | | 1 | 2 | 3 | #+TBLFM: @1$1='(format "#&...
aadcg's user avatar
  • 1,248
3 votes

Can I format cells in an org-mode table differently depending on a formula?

I created the following mechanism for highlighting positive and negative numbers in org tables similar to how a spreadsheet program might do it: (defface positive-face '((t :foreground "green&...
Erki der Loony's user avatar
2 votes
Accepted

Org table spreadsheet use column name on left hand side

Simulate LHS Column Name Assignments Simulate Left Hand Side (LHS) column name assignments using named fields and a keyboard macro. Update your example table and formulas as follows: | | Runde | ...
Melioratus's user avatar
  • 4,688
2 votes
Accepted

Org mode: Using elisp formula to automatically sort tables

org-table-sort-lines does not return the sorted table as your first formula assumes: instead, it operates by side-effect, modifying the table in place. It just so happens that the last thing it calls ...
NickD's user avatar
  • 30.9k
2 votes
Accepted

Calculating overtime in org tables

When you turn on the Org Table Formula Debugger, e.g., M-x org-table-formula-debugger RET and re-calculate the table, you see that calc actually calculates with seconds. It is also described in the ...
Tobias's user avatar
  • 33.3k
2 votes
Accepted

sin() function in org-calc being weird?

As documented, the argument of sin is in degrees, not radians. See e.g. Angular Modes. Use $3=sin($4);R to use radians intead.
choroba's user avatar
  • 2,075
2 votes

Org table spreadsheet recalculate all TBLFM lines

Everything is possible since you can arbitrarily modify a buffer temporarily before applying a command with cmdbufmod from the answer to the question about a single tblfm for multiple org tables. The ...
Tobias's user avatar
  • 33.3k
1 vote

In org-mode, can I show the formula of the table cell at point in eldoc?

Destructure the message emitted by stock org-table-field-info with pcase rx pattern may be Done. What does the Elisp Recipe do? Recipe This recipe does the following mouse-1 on a table cell ...
mxnt's user avatar
  • 696
1 vote

In org-mode, can I show the formula of the table cell at point in eldoc?

(Or is there some other way to quickly show which cells are "input" vs "output"?) The snippet gives the contour of possible solution and is NOT production ready. Right now, it ...
mxnt's user avatar
  • 696
1 vote

In org-mode, can I show the formula of the table cell at point in eldoc?

I'd like C-c ? to happen automatically when I focus on a table cell, i To get this mouse-1 or left click shows table cell info at point do this (defun my-org-table-info (&optional event promote-...
mxnt's user avatar
  • 696
1 vote
Accepted

Is it because this org-table formula contains double quotes it doesn't work?

This is caused by a bug in org-table-eval-formula: the literal semicolon in the formula is misparsed as a format spec. The function does a naive search for a semicolon without taking into account that ...
NickD's user avatar
  • 30.9k
1 vote

org-table, fetch a specific cell from all tables in a file

You can use org-element-map on a parsed buffer to select elements or objects of a given type to operate on with a function. Here's an example for getting the names of all the named tables in the ...
NickD's user avatar
  • 30.9k
1 vote
Accepted

org table apply formula from specific row onwards

In this particular situation, you could use a range formula to fill in rows 7 through the last row: #+TBLFM: @7$2..@>$2 = $3 + 58 Counting rows is probably not what you want to do though and is ...
NickD's user avatar
  • 30.9k
1 vote
Accepted

Row descriptor -X leads outside table

You may well be right about the eager evaluation (which might be a bug). EDIT: Actually, there is no evaluation at all: the user error is precipitated just by pattern matching - while in row 2, it ...
NickD's user avatar
  • 30.9k
1 vote
Accepted

Why does all but the first `org-lookup-first` returns nil

OK. My fault. When I was revising the proposal of @Melioratus, I noticed that in some formulas I was not including the two dots to indicate range, specifically in the calculation of the fields that ...
aBarocio80's user avatar
1 vote
Accepted

Is there a way to calculate rows on a "rolling" basis?

Using relative row references it is possible to calculate balance from previous row. With initial table and formula: | month | balance | income | expenses | net | |-------+---------+---------+------...
muffinmad's user avatar
  • 2,320
1 vote
Accepted

Using an org-table formula to sum up weekly time cards

Your modifications to the table are quite complex. Maybe it is better to filter the table through a source block. In the following I include a source block that enters the project sums and the total ...
Tobias's user avatar
  • 33.3k
1 vote

Make org-mode table formulas use common arithmetic precedence

org-mode uses calc to compute formulas, and calc uses non-standard operator precedence. From the org manual, (org) Formula syntax for Calc: A formula can be any algebraic expression understood by ...
Tyler's user avatar
  • 22.4k

Only top scored, non community-wiki answers of a minimum length are eligible