emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* formulas in spreadsheet to increase date
@ 2011-08-16 23:29 Matt Price
  2011-08-17  7:35 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Price @ 2011-08-16 23:29 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 631 bytes --]

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?  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.

Thanks as always,
matt

[-- Attachment #2: Type: text/html, Size: 717 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: formulas in spreadsheet to increase date
  2011-08-16 23:29 formulas in spreadsheet to increase date Matt Price
@ 2011-08-17  7:35 ` Nick Dokos
  2011-08-17 13:32   ` Matt Price
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2011-08-17  7:35 UTC (permalink / raw)
  To: Matt Price; +Cc: nicholas.dokos, Org Mode

Matt Price <moptop99@gmail.com> 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:
> 
> ----------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: formulas in spreadsheet to increase date
  2011-08-17  7:35 ` Nick Dokos
@ 2011-08-17 13:32   ` Matt Price
  0 siblings, 0 replies; 3+ messages in thread
From: Matt Price @ 2011-08-17 13:32 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1589 bytes --]

On Wed, Aug 17, 2011 at 3:35 AM, Nick Dokos <nicholas.dokos@hp.com> wrote:

> Matt Price <moptop99@gmail.com> 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))
>
>
> ah, supercool.  thank you!!

matt

[-- Attachment #2: Type: text/html, Size: 2176 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-17 13:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-16 23:29 formulas in spreadsheet to increase date Matt Price
2011-08-17  7:35 ` Nick Dokos
2011-08-17 13:32   ` Matt Price

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).