emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: mail@christianmoe.com
Cc: emacs-orgmode List <emacs-orgmode@gnu.org>
Subject: Re: Table rows and ranges as LHS of formulas
Date: Thu, 3 Mar 2011 00:16:12 +0100	[thread overview]
Message-ID: <BA34928C-1FF9-44C9-9471-3167199D725C@gmail.com> (raw)
In-Reply-To: <4D6ECE2E.5040504@christianmoe.com>


On 3.3.2011, at 00:09, Christian Moe wrote:

> Hi, Carsten,
> 
> Yes, it's really neat.
> 
> I just realized, though, that there *is* an equally clean way to generate such tables in OOo Calc (which the Org spreadsheet has all but replaced for my needs):
> 
> - Place 1 in cell B1. Drag across to get 1-10 in cells B1:K1.
> - Place 1 in cell A2. Drag down to get 1-10 in cells A2:A11.
> - In cell B2, type the formula =B1:K1*A2:A11. Do NOT press Enter, press Ctrl-Shift-Enter (or Cmd-Shift-Enter on Mac) to make it an "array formula" (it presents as {=B1:K1*A2:A11}).
> - Hey presto, the table is filled.

Indeed, this sounds equally compact.  Thanks!

- Carsten

> 
> Yours,
> Christian
> 
> 
> On 3/2/11 6:31 PM, Carsten Dominik wrote:
>> Hi Christian,
>> 
>> thanks for the great example!  I guess this is really something
>> Org has over other spreadsheets.  No copy-and-paste-with-modification,
> > just a single formula.
>> 
>> - Carsten
>> 
>> On 2.3.2011, at 17:11, Christian Moe wrote:
>> 
>>> Hi,
>>> 
>>> Row formulas are great! I've missed this, but learned to work around it, since I I just assumed that if you hadn't already done it, it was not a reasonable thing to ask for.
>>> 
>>> Testing... So now we can simply do e.g.:
>>> 
>>> #+CAPTION: A multiplication table
>>> |    | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
>>> |----+---+---+---+---+---+---+---+---+---+----|
>>> |  1 |   |   |   |   |   |   |   |   |   |    |
>>> |  2 |   |   |   |   |   |   |   |   |   |    |
>>> |  3 |   |   |   |   |   |   |   |   |   |    |
>>> |  4 |   |   |   |   |   |   |   |   |   |    |
>>> |  5 |   |   |   |   |   |   |   |   |   |    |
>>> |  6 |   |   |   |   |   |   |   |   |   |    |
>>> |  7 |   |   |   |   |   |   |   |   |   |    |
>>> |  8 |   |   |   |   |   |   |   |   |   |    |
>>> |  9 |   |   |   |   |   |   |   |   |   |    |
>>> | 10 |   |   |   |   |   |   |   |   |   |    |
>>> #+TBLFM: @2$2..@11$11=@1*$1
>>> 
>>> C-c C-c...and hey presto:
>>> 
>>> #+CAPTION: A multiplication table
>>> |    |  1 |  2 |  3 |  4 |  5 |  6 |  7 |  8 |  9 |  10 |
>>> |----+----+----+----+----+----+----+----+----+----+-----|
>>> |  1 |  1 |  2 |  3 |  4 |  5 |  6 |  7 |  8 |  9 |  10 |
>>> |  2 |  2 |  4 |  6 |  8 | 10 | 12 | 14 | 16 | 18 |  20 |
>>> |  3 |  3 |  6 |  9 | 12 | 15 | 18 | 21 | 24 | 27 |  30 |
>>> |  4 |  4 |  8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 |  40 |
>>> |  5 |  5 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 |  50 |
>>> |  6 |  6 | 12 | 18 | 24 | 30 | 36 | 42 | 48 | 54 |  60 |
>>> |  7 |  7 | 14 | 21 | 28 | 35 | 42 | 49 | 56 | 63 |  70 |
>>> |  8 |  8 | 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72 |  80 |
>>> |  9 |  9 | 18 | 27 | 36 | 45 | 54 | 63 | 72 | 81 |  90 |
>>> | 10 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100 |
>>> #+TBLFM: @2$2..@11$11=@1*$1
>>> 
>>> 
>>> Yours,
>>> Christian
>>> 
>>> On 3/1/11 3:28 PM, Carsten Dominik wrote:
>>>> Hi everyone,
>>>> 
>>>> A frequently requested feature for tables has been to
>>>> be able to define row formulas in a way similar to column
>>>> formulas.  The patch below allows things like
>>>> 
>>>>    @3=
>>>>    @2$2..@5$7=
>>>>    @I$2..@II$4=
>>>> 
>>>> as the left hand side for table formulas in order to
>>>> write a formula that is valid for an entire column or
>>>> for a rectangular section in a table.
>>>> 
>>>> Note that in contrast to column formulas, @3= will not
>>>> automatically skip a "header column" or field formulas in the
>>>> same row.  In fact, making both a range formula and a field
>>>> point to the same field is forbidden and throws an error.
>>>> So to have a formula apply to all but the first column, use
>>>> something like this:
>>>> 
>>>>     @3$2..@3$8=....
>>>> 
>>>> Testing is welcome, but I am confident that this works
>>>> pretty well.
>>>> 
>>>> Bastien, please let me know if you want to have this integrated
>>>> before the release, then I will do so.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Emacs-orgmode mailing list
>>>> Please use `Reply All' to send replies to the list.
>>>> Emacs-orgmode@gnu.org
>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>> 
>> 
>> 
> 


--
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2011-03-02 23:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01 14:28 Table rows and ranges as LHS of formulas Carsten Dominik
2011-03-01 15:10 ` Carsten Dominik
2011-03-02 16:11 ` Christian Moe
2011-03-02 16:46   ` Bernt Hansen
2011-03-02 17:31   ` Carsten Dominik
2011-03-02 23:09     ` Christian Moe
2011-03-02 23:16       ` Carsten Dominik [this message]
2011-03-02 17:21 ` Bastien
2011-03-02 17:35   ` Carsten Dominik
2011-03-02 18:54     ` Nick Dokos
2011-03-02 20:00       ` Suvayu Ali
2011-03-02 22:57       ` Carsten Dominik
2011-03-02 23:08         ` Samuel Wales
2011-03-03  4:18         ` Nick Dokos
2011-03-03  8:28           ` Bastien
2011-03-03 12:23             ` Carsten Dominik
2011-03-03 16:46               ` Bastien
2011-03-03 12:23           ` Carsten Dominik
2011-03-03 21:19           ` Carsten Dominik
2011-03-03 22:01             ` Suvayu Ali
2011-03-03 22:11               ` Nick Dokos
2011-03-03 22:25                 ` Suvayu Ali
2011-03-04  5:41                 ` Carsten Dominik

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=BA34928C-1FF9-44C9-9471-3167199D725C@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@christianmoe.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).