emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Matt Price <moptop99@gmail.com>
Cc: nicholas.dokos@hp.com, Org Mode <emacs-orgmode@gnu.org>
Subject: Re: formulas in spreadsheet to increase date
Date: Wed, 17 Aug 2011 03:35:17 -0400	[thread overview]
Message-ID: <21851.1313566517@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Matt Price <moptop99@gmail.com> of "Tue\, 16 Aug 2011 19\:29\:18 EDT." <CAN_Dec8w4-pV0RA2fPAYspCQBwxTbjbc8=AeurcR=VPxC_W6xg@mail.gmail.com>

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:
> 
> ----------------------------------------------------

  reply	other threads:[~2011-08-17  7:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16 23:29 formulas in spreadsheet to increase date Matt Price
2011-08-17  7:35 ` Nick Dokos [this message]
2011-08-17 13:32   ` Matt Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21851.1313566517@alphaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=moptop99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).