emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org table: how to reference part of the rows
@ 2017-12-16 11:24 Qiang Fang
  2017-12-17 15:53 ` Eric S Fraga
  0 siblings, 1 reply; 3+ messages in thread
From: Qiang Fang @ 2017-12-16 11:24 UTC (permalink / raw)
  To: emacs-orgmode

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

The last column is the ratio between column b and a, the last row is the
sum of
each row, the second formula only applies from the second row to the row
before
last row. The table that doesn't work is:

    |     |      a |     b |      ratio |
    |     |  0.797 | 0.780 |            |
    |     |  0.744 | 0.730 |            |
    |     | 12.707 | 2.384 |            |
    | sum | 14.248 | 3.114 | 0.92040988 |
    | ^   |      x |     y |            |
    #+tblfm: $x=vsum(@2..@-1) :: $y=vsum(@3..@-1)
    #+tblfm: $4 = ($3 / $2) * 100

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

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

* Re: Org table: how to reference part of the rows
  2017-12-16 11:24 Org table: how to reference part of the rows Qiang Fang
@ 2017-12-17 15:53 ` Eric S Fraga
  2017-12-18  1:04   ` Qiang Fang
  0 siblings, 1 reply; 3+ messages in thread
From: Eric S Fraga @ 2017-12-17 15:53 UTC (permalink / raw)
  To: Qiang Fang; +Cc: emacs-orgmode

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

On Saturday, 16 Dec 2017 at 19:24, Qiang Fang wrote:
> The last column is the ratio between column b and a, the last row is
> the sum of each row, the second formula only applies from the second
> row to the row before last row. The table that doesn't work is:
>
>     |     |      a |     b |      ratio |
>     |     |  0.797 | 0.780 |            |
>     |     |  0.744 | 0.730 |            |
>     |     | 12.707 | 2.384 |            |
>     | sum | 14.248 | 3.114 | 0.92040988 |
>     | ^   |      x |     y |            |
>     #+tblfm: $x=vsum(@2..@-1) :: $y=vsum(@3..@-1)
>     #+tblfm: $4 = ($3 / $2) * 100

I cannot help with the OP's question but this table leads to very
strange behaviour for me.  If I delete the tblfm lines, then go to the
location of the x variable (5th row, 2nd column) and type C-u C-c = to
enter "x=vsum(@2..@i-1)", that is okay.  But if I then go to the next
column and try to enter the equivalent formula for y, it replaces the
previously entered formula for x!  If I go back to the x location and
re-enter that formula, it replaces the y formula.

Further, the formulae created by org are missing the $ in front of the
variable, i.e. x=vsum(...) instead of $x=vsum(...).

This happens with up to date org from git as of an hour or so ago.

For the OP, the formulas

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.4-214-ge8b71b

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: Org table: how to reference part of the rows
  2017-12-17 15:53 ` Eric S Fraga
@ 2017-12-18  1:04   ` Qiang Fang
  0 siblings, 0 replies; 3+ messages in thread
From: Qiang Fang @ 2017-12-18  1:04 UTC (permalink / raw)
  To: Qiang Fang, emacs-orgmode

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

I solved my problem by specifying the column range
 #+tblfm: @2$4..@-2$4 = ($3 / $2) * 100


On Sun, Dec 17, 2017 at 11:53 PM, Eric S Fraga <esflists@gmail.com> wrote:

> On Saturday, 16 Dec 2017 at 19:24, Qiang Fang wrote:
> > The last column is the ratio between column b and a, the last row is
> > the sum of each row, the second formula only applies from the second
> > row to the row before last row. The table that doesn't work is:
> >
> >     |     |      a |     b |      ratio |
> >     |     |  0.797 | 0.780 |            |
> >     |     |  0.744 | 0.730 |            |
> >     |     | 12.707 | 2.384 |            |
> >     | sum | 14.248 | 3.114 | 0.92040988 |
> >     | ^   |      x |     y |            |
> >     #+tblfm: $x=vsum(@2..@-1) :: $y=vsum(@3..@-1)
> >     #+tblfm: $4 = ($3 / $2) * 100
>
> I cannot help with the OP's question but this table leads to very
> strange behaviour for me.  If I delete the tblfm lines, then go to the
> location of the x variable (5th row, 2nd column) and type C-u C-c = to
> enter "x=vsum(@2..@i-1)", that is okay.  But if I then go to the next
> column and try to enter the equivalent formula for y, it replaces the
> previously entered formula for x!  If I go back to the x location and
> re-enter that formula, it replaces the y formula.
>
> Further, the formulae created by org are missing the $ in front of the
> variable, i.e. x=vsum(...) instead of $x=vsum(...).
>
> This happens with up to date org from git as of an hour or so ago.
>
> For the OP, the formulas
>
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.1.4-214-ge8b71b
>

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

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

end of thread, other threads:[~2017-12-18  1:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-16 11:24 Org table: how to reference part of the rows Qiang Fang
2017-12-17 15:53 ` Eric S Fraga
2017-12-18  1:04   ` Qiang Fang

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