emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Calc: Second to last row
@ 2016-08-31 15:14 Karl Voit
  2016-08-31 22:21 ` Nick Dokos
  2016-09-01  8:53 ` Karl Voit
  0 siblings, 2 replies; 3+ messages in thread
From: Karl Voit @ 2016-08-31 15:14 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

I would like to refer to the second to last row of a table.

The following example should demonstrate my issue. What I expect is
that the following formula is filling @2..@5 with "1" and in the
last row, there is the sum of all "1".

It is important to me to ignore the number of horizontal lines since
their number varies in my case.

| Values |
|--------|
|        |
|        |
|--------|
|        |
|        |
|--------|
|        |
#+TBLFM: @2$1..@>-1$1=1 :: @>$1=vsum(@2$1..@>-1$1)

Expected result:

| Values |
|--------|
|      1 |
|      1 |
|--------|
|      1 |
|      1 |
|--------|
|      4 |

Actual result: "user-error: Several field/range formulas try to set
@8$1".

With a fixed number of horizontal lines, the sum would be:
#+TBLFM: @>$1=vsum(@2$1..@III$1);T


So how can this be accomplished for an arbitrary number of
horizontal lines?


At my side: Org-mode version 8.3.4 (release_8.3.4-33-gd522fc)

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

* Re: Calc: Second to last row
  2016-08-31 15:14 Calc: Second to last row Karl Voit
@ 2016-08-31 22:21 ` Nick Dokos
  2016-09-01  8:53 ` Karl Voit
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Dokos @ 2016-08-31 22:21 UTC (permalink / raw)
  To: emacs-orgmode

Karl Voit <devnull@Karl-Voit.at> writes:

> Hi!
>
> I would like to refer to the second to last row of a table.
>
> The following example should demonstrate my issue. What I expect is
> that the following formula is filling @2..@5 with "1" and in the
> last row, there is the sum of all "1".
>
> It is important to me to ignore the number of horizontal lines since
> their number varies in my case.
>
> | Values |
> |--------|
> |        |
> |        |
> |--------|
> |        |
> |        |
> |--------|
> |        |
>
> #+TBLFM: @2$1..@>-1$1=1 :: @>$1=vsum(@2$1..@>-1$1)

This should be:

#+TBLFM: @2$1..@>>$1=1 :: @>$1=vsum(@2$1..@>>$1)

>
> Expected result:
>
> | Values |
> |--------|
> |      1 |
> |      1 |
> |--------|
> |      1 |
> |      1 |
> |--------|
> |      4 |
>
> Actual result: "user-error: Several field/range formulas try to set
> @8$1".
>
> With a fixed number of horizontal lines, the sum would be:
>
> #+TBLFM: @>$1=vsum(@2$1..@III$1);T
>
> So how can this be accomplished for an arbitrary number of
> horizontal lines?
>
>
> At my side: Org-mode version 8.3.4 (release_8.3.4-33-gd522fc)

-- 
Nick

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

* Re: Calc: Second to last row
  2016-08-31 15:14 Calc: Second to last row Karl Voit
  2016-08-31 22:21 ` Nick Dokos
@ 2016-09-01  8:53 ` Karl Voit
  1 sibling, 0 replies; 3+ messages in thread
From: Karl Voit @ 2016-09-01  8:53 UTC (permalink / raw)
  To: emacs-orgmode

* Karl Voit <devnull@Karl-Voit.at> wrote:
>
> I would like to refer to the second to last row of a table.
>
> The following example should demonstrate my issue. What I expect is
> that the following formula is filling @2..@5 with "1" and in the
> last row, there is the sum of all "1".

I am happy to have found the answer to my question on my own: @>> is
the second to last row. @>>> the one before. Same holds for columns:
$>> is the second to last column. 

The solution for my example is:

| Values |
|--------|
|      1 |
|      1 |
|      1 |
|--------|
|      1 |
|      1 |
|      1 |
|--------|
|      6 |
#+TBLFM: @2$1..@>>$1=1 :: @>$1=vsum(@2$1..@>>$1)

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

end of thread, other threads:[~2016-09-01  9:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-31 15:14 Calc: Second to last row Karl Voit
2016-08-31 22:21 ` Nick Dokos
2016-09-01  8:53 ` Karl Voit

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