emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] formulas in spreadsheet to increase date


From: Nick Dokos
Subject: Re: [O] formulas in spreadsheet to increase date
Date: Wed, 17 Aug 2011 03:35:17 -0400

Matt Price <address@hidden> wrote:

> Hi,
> 
> It's htat time of year again and I'm putting together course syllabi.  I 
> would really love to be able
> to dynamically calculate dates in a spreadsheet, e.g.:
> 
> |Topic 1|Date1|Description1|
> |Topic2|Above Date + 7| Description2|
> |Topic3|Above Date + 7| Description3|
> 
> Is there a way for me to do that?  

As usual in situations like this, you have to start things off with
a field formula for the first date. The column formula then can be
used to calculate all the *other* rows (field formulas override column
formulas - see section 3.5.6, "Column formulas", in the org manual
or evaluate (info "(org) Column formulas") to get there directly).

| Topic 1 | <2011-08-17 Wed> | Description1 |
| Topic2  | <2011-08-24 Wed> | Description2 |
| Topic3  | <2011-08-31 Wed> | Description3 |
#+TBLFM: @1$2=<2011-08-17> :: $2 = <@-1$2> + 7

The column formula says: get the field from the row above and the same
column (@-1$2), interpret it as a date (<..>) and add 7 (days) to it.
The column formula can be simplified to $2 = <@-1> + 7.

If you want to increment by e.g. 10 mins, the increment has to be
calculated as a fraction of a day:

| Topic 1 | <2011-09-18 Sun 10:20> | Description1 |
| Topic2  | <2011-09-18 Sun 10:30> | Description2 |
| Topic3  | <2011-09-18 Sun 10:40> | Description3 |
#+TBLFM: @1$2=<2011-09-18 10:20> :: $2 = <@-1> + 10*(1/24*60))


> Even better would be to be able to do the same thing in headlines,
> e.g.:
> ** 0. <2011-09-13 Tue>[[file:./syllabus/what-is-history-for][What is History 
> For?]]
> ** 1.  <Last Date Plus 7> 
> [[file:Syllabus/history-and-the-public-sphere][History and the Public
> Sphere]]
> 
> but there I'm in deeper water, I think.
> 

So am I.

Nick

> Thanks as always,
> matt
> 
> 
> ----------------------------------------------------
> Alternatives:
> 
> ----------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]