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:
| Item | Weight | Label Price | ...
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 use M-x customize-option RET org-calc-default-modes. Insert an entry with key calc-language and value c.
The language c is just an example here. There are many ...
Is it something like the example below:
| Name | Age | Date of Birth | Income |
| Joe | 30 years old | <1984-02-20 Mon> | 84000 |
| Mark | 40 years old | <1974-04-15 Mon> | 120000 |
| Sophie | 44 years old | <1970-08-28 Fri> | 150000 |
| Anna | 26 years old | <...
Using an overlay is how I'm going to want to do it. I can hook into org-ctrl-c-ctrl-c-hook. It means I can press C-c C-c to run the check.
I need to properly check that I'm inside a table and run this for all cells.
Then I probably need to hook into the alignment function to either redo the overlays or at least clear them.
This code will make the cell ...
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 only the first #+tblfm: line when otherwise updating the table formulas.
When the amount of formulas is getting too cumbersome to edit the #+tblfm: line itself ...
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 2 and is within the cell of a table. Try this:
| *\(-[0-9]+\|[03-9]\|[0-9][0-9]+\) *|
(You can recall previous expressions with M-n and M-p.)
This is not yet an answer but I want to keep track of the things I discover here, as they may give someone else an idea.
It is possible to conditionally modify the value of the cell itself:
We can create a formatting function in elisp and then call it from the formula line:
#+BEGIN_SRC emacs-lisp :results silent
(defun danger (cell)
(if (or (< (...
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 within lisp forms are resolved as strings by default. If you can add another column to your table you can use a lisp form as simple and self-explanatory as (cl-...
See Section "3.5.3 Emacs Lisp forms as formulas" of the orgmode manual or see http://orgmode.org/worg/org-tutorials/org-spreadsheet-lisp-formulas.html.
The lisp expression is introduced by a single quote and embraced in parentheses. You can use cell references in the lisp expression. They are replaced by the cell entries as string by default. But you can ...
Basically every table manipulating function is updating formulas. For example : M-S-right includes a new column (before the cursor) updating formulas to the new number of columns.
C-u C-c * is recalculating all your formulas in the spreadsheet.
Also a C-c C-c on a #+tblfm: line is (re)applying all the formulas in the table.
For more advanced stuff, like ...
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 following code defines an :around advice org-table-multi-tblfm for org-table-recalculate that joins successive #+TBLFM:-lines before running org-table-...
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 | 0 | 1 | 2 | Resultat | % |
| ! | | c0 | c1 | cn | | |
| _ | name | ...
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 the Emacs ‘Calc’
package. Note that ‘calc’ has the non-standard convention that ‘/’ has
lower precedence than ‘*’, so that ‘a/b*c’ is interpreted as ‘a/(b*c)...
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 error-prone, so you could say
#+TBLFM: $2 = if ($2 > 0, $2, $3+58)
leaving the non-empty entries alone, and changing the empty entries (which in a numerical ...
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 finds the @-14$6 in the formula and proceeds to check it immediately; it does not matter at all that the formula would never hit that. Fixing that is probably ...
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 yield =nil=.
Here are the original formulas:
#+TBLFM: $5='(org-lookup-first $no '(remote(E1Ap1,@I$no@II$no)) '(remote(E1Ap1, @I$tot..@II$tot))) :: $6='(org-...
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 sums.
There are three major drawbacks.
The table is duplicated
The minus signs are replaced by zeros. (The table is already passed to the source block in that ...
Use formulas, as suggested by @wvxvw in the comments. mapconcat is a nice option for joining strings:
| 名字 | 内容1 | 内容2 | 结果 results |
| Mr. 域 | dear | happy | dear Mr. 域 happy |
#+TBLFM: $4='(mapconcat 'identity (list $2 $1 $3) " ")