8

Let's say I have the following table:

| Name   | Age              | Date of Birth    | Income |
|--------+------------------+------------------+--------|
| Joe    |                  | <1984-02-20 Mon> |  84000 |
| Mark   |                  | <1974-04-15 Mon> | 120000 |
| Sophie |                  | <1970-08-28 Fri> | 150000 |
| Anna   |                  | <1988-02-29 Mon> | 160000 |

I want the second column to be the amount of years elapsed since the date in the third column.

I can't figure out how to do this with the TBLFM settings.

1 Answer 1

9

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 | <1988-02-29 Mon> | 160000 |
#+TBLFM: $2=(now()-$3)/365;%d years old
3
  • Thank you! Where can I find out that there are such things as now() ?
    – Trevoke
    Commented Jan 28, 2015 at 12:33
  • 1
    gnu.org/software/emacs/manual/html_mono/…
    – wdkrnls
    Commented Jan 28, 2015 at 12:54
  • 1
    @Trevoke Another way, which would typically work is to try C-h f calc-now - most Calc functions will have a corresponding Emacs Lisp function with the name prefixed with calc-.
    – wvxvw
    Commented Jan 28, 2015 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.