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.

up vote 8 down vote accepted

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
  • Thank you! Where can I find out that there are such things as now() ? – Trevoke Jan 28 '15 at 12:33
  • 1
  • 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 Jan 28 '15 at 15:37

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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