From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: formulas in spreadsheet to increase date Date: Wed, 17 Aug 2011 03:35:17 -0400 Message-ID: <21851.1313566517@alphaville.dokosmarshall.org> References: Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:45902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qtaeo-0007lq-28 for emacs-orgmode@gnu.org; Wed, 17 Aug 2011 03:35:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qtaen-0007MU-3m for emacs-orgmode@gnu.org; Wed, 17 Aug 2011 03:35:22 -0400 Received: from g6t0187.atlanta.hp.com ([15.193.32.64]:9320) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qtaem-0007MJ-OV for emacs-orgmode@gnu.org; Wed, 17 Aug 2011 03:35:20 -0400 In-Reply-To: Message from Matt Price of "Tue\, 16 Aug 2011 19\:29\:18 EDT." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Matt Price Cc: nicholas.dokos@hp.com, Org Mode Matt Price wrote: > Hi, >=20 > It's htat time of year again and I'm putting together course syllabi.=C2= =A0 I would really love to be able > to dynamically calculate dates in a spreadsheet, e.g.: >=20 > |Topic 1|Date1|Description1| > |Topic2|Above Date + 7| Description2| > |Topic3|Above Date + 7| Description3| >=20 > Is there a way for me to do that?=C2=A0=20 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=3D<2011-08-17> :: $2 =3D <@-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 =3D <@-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=3D<2011-09-18 10:20> :: $2 =3D <@-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 Hist= ory For?]] > ** 1.=C2=A0 [[file:Syllabus/history-and-the-public-sph= ere][History and the Public > Sphere]] >=20 > but there I'm in deeper water, I think. >=20 So am I. Nick > Thanks as always, > matt >=20 >=20 > ---------------------------------------------------- > Alternatives: >=20 > ----------------------------------------------------