From: Nick Dokos <nicholas.dokos@hp.com>
To: Ethan Ligon <ligon@are.berkeley.edu>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: Date calculations in spreadsheet
Date: Sat, 04 Dec 2010 19:56:12 -0500 [thread overview]
Message-ID: <18596.1291510572@gamaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Ethan Ligon <ligon@are.berkeley.edu> of "Sat, 04 Dec 2010 15:19:13 PST." <87sjydxh1q.fsf@are.berkeley.edu>
Ethan Ligon <ligon@are.berkeley.edu> wrote:
> I'm working with a small spreadsheet, and would like to know how to
> manage date calculations within the spreadsheet. For example,
>
> * How to do date calculations in a spreadsheet?
> |------------------+--------------|
> | Date | Days elapsed |
> |------------------+--------------|
> | [2009-12-03 Thu] | |
> | [2010-12-03 Fri] | 365 |
> | [2010-12-06 Mon] | 3 |
> |------------------+--------------|
>
> The question: What's the simplest way to construct a column formula for
> the second column to deliver the indicated results?
>
In the format above, there are problems that have nothing to do with dates:
you'd need conditional code to distinguish between the first row and later
rows. So I reorganized your table a bit in order to illustrate the date calculation:
--8<---------------cut here---------------start------------->8---
* How to do date calculations in a spreadsheet?
|------------------+------------------+--------------|
| Date start | Date end | Days elapsed |
|------------------+------------------+--------------|
| [2009-12-03 Thu] | [2010-12-03 Fri] | 365 |
| [2010-12-03 Fri] | [2010-12-06 Mon] | 3 |
#+TBLFM: $3 = date(<$2>) - date(<$1>)
--8<---------------cut here---------------end--------------->8---
> And finally, my usual obligatory apology for not noticing the exhaustive
> thread on exactly this topic that I've undoubtedly missed. 8^)
>
Well, after this I felt duty bound to find the thread:
http://thread.gmane.org/gmane.emacs.orgmode/7741
Actually, it's only one of the threads on date calculations and is not
exhaustive, but what the hey ;-)
Many thanks to Chris Randle for coming up with the original solution. I
have now used his answer some half a dozen times to answer questions on
the list: the gift that keeps on giving, to coin a phrase...
Nick
next prev parent reply other threads:[~2010-12-05 0:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-04 23:19 Date calculations in spreadsheet Ethan Ligon
2010-12-05 0:56 ` Nick Dokos [this message]
2010-12-05 2:00 ` Michael Brand
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=18596.1291510572@gamaville.dokosmarshall.org \
--to=nicholas.dokos@hp.com \
--cc=emacs-orgmode@gnu.org \
--cc=ligon@are.berkeley.edu \
/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).