emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* how to refer row's by name in a spreadsheet formula?
@ 2011-07-07  8:44 jiangzuoyan
  2011-07-08  8:14 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: jiangzuoyan @ 2011-07-07  8:44 UTC (permalink / raw)
  To: emacs-org

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

Hi list,

Formulas reference in a long table are very easy corrupted by manually
inserting. so, I think, refer using name instead of num. is better.

but how to refer the rows by name?

For example,

|---+------+---------+--------+---------+------|
| ! | date | amount  | item   | account | note |
|   | date | amount  | item   | account | note |
|---+------+---------+--------+---------+------|
| _ |      | bamount |        |         |      |
|   |      | 12      | lunch  | pocket  |      |
|   |      | 59      | dinner | pocket  |      |
| ^ |      | eamount |        |         |      |
|---+------+---------+--------+---------+------|
| _ |      | total   |        |         |      |
| # |      | #ERROR  |        |         |      |
|---+------+---------+--------+---------+------|
#+TBLFM: $total=vsum($bamount..$eamount);%.2f

I'd expected $bamount..$eamount is the range of @II$amount..@III$amount, but
it's not. $bamount and $eamount are epxanded to the values too early.




                                                      Changsheng Jiang

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

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

* Re: how to refer row's by name in a spreadsheet formula?
  2011-07-07  8:44 how to refer row's by name in a spreadsheet formula? jiangzuoyan
@ 2011-07-08  8:14 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2011-07-08  8:14 UTC (permalink / raw)
  To: jiangzuoyan@gmail.com; +Cc: emacs-org

Hi Jiang,

"jiangzuoyan@gmail.com" <jiangzuoyan@gmail.com> writes:

> Formulas reference in a long table are very easy corrupted by
> manually inserting. so, I think, refer using name instead of num. is
> better.
>
> but how to refer the rows by name?
>
> For example,
>
> |---+------+---------+--------+---------+------|
> | ! | date | amount  | item   | account | note |
> |   | date | amount  | item   | account | note |
> |---+------+---------+--------+---------+------|
> | _ |      | bamount |        |         |      |
> |   |      | 12      | lunch  | pocket  |      |
> |   |      | 59      | dinner | pocket  |      |
> | ^ |      | eamount |        |         |      |
> |---+------+---------+--------+---------+------|
> | _ |      | total   |        |         |      |
> | # |      | #ERROR  |        |         |      |
> |---+------+---------+--------+---------+------|
> #+TBLFM: $total=vsum($bamount..$eamount);%.2f
>
> I'd expected $bamount..$eamount is the range of
> @II$amount..@III$amount, but it's not. $bamount and $eamount are
> epxanded to the values too early.

I see the problem you have.  

To my understanding, field names like "bamount" and "eamount" refer to
the _value_ of the above/below field, not to the _position_.  So when
the formula is computed, these names are replaced by values, not by
position -- hence the result you have.

I'm not sure this is by design.

Maybe Carsten can tell more, and/or have a look in this issue when he's
back. 

Best,

-- 
 Bastien

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

end of thread, other threads:[~2011-07-08  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-07  8:44 how to refer row's by name in a spreadsheet formula? jiangzuoyan
2011-07-08  8:14 ` Bastien

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