* Can this table formula be done more efficient
@ 2014-06-08 10:19 Cecil Westerhof
2014-06-08 11:53 ` Nick Dokos
0 siblings, 1 reply; 5+ messages in thread
From: Cecil Westerhof @ 2014-06-08 10:19 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 508 bytes --]
At the moment I am using the following formula:
#+TBLFM: @<<$4..@>>$4 = $2 - $3 :: @>$2=vsum(@<<$2..@>>$2) ::
@>$3=vsum(@<<$3..@>>$3) :: @>$4=vsum(@<<$4..@>>$4)
This does what I want, but there are two things that could be improved.
- The second, third and fourth formula do exactly the same, only on
different columns. Could this be rewritten to one formula?
- The line becomes long and hard to evaluate for a person. Is there a
possibility to put the formulas below each-other?
--
Cecil Westerhof
[-- Attachment #2: Type: text/html, Size: 940 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can this table formula be done more efficient
2014-06-08 10:19 Can this table formula be done more efficient Cecil Westerhof
@ 2014-06-08 11:53 ` Nick Dokos
2014-06-08 13:07 ` Eric Schulte
2014-06-09 7:04 ` Cecil Westerhof
0 siblings, 2 replies; 5+ messages in thread
From: Nick Dokos @ 2014-06-08 11:53 UTC (permalink / raw)
To: emacs-orgmode
Cecil Westerhof <cldwesterhof@gmail.com> writes:
> At the moment I am using the following formula:
> #+TBLFM: @<<$4..@>>$4 = $2 - $3 :: @>$2=vsum(@<<$2..@>>$2) :: @>$3=vsum(@<<$3..@>>$3) :: @>$4=vsum(@<<$4..@>>$4)
>
> This does what I want, but there are two things that could be improved.
>
> - The second, third and fourth formula do exactly the same, only on different columns. Could this be rewritten to one formula?
>
--8<---------------cut here---------------start------------->8---
#+TBLFM: @<<$4..@>>$4 = $2 - $3 :: @>$2..$4=vsum(@<<$0..@>>$0)
--8<---------------cut here---------------end--------------->8---
See (info "(org) References")
> - The line becomes long and hard to evaluate for a person. Is there a possibility to put the formulas below each-other?
>
I don't believe so but my belief may be out of date. It has been
discussed before: check the list archives.
--
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can this table formula be done more efficient
2014-06-08 11:53 ` Nick Dokos
@ 2014-06-08 13:07 ` Eric Schulte
2014-06-09 7:06 ` Cecil Westerhof
2014-06-09 7:04 ` Cecil Westerhof
1 sibling, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2014-06-08 13:07 UTC (permalink / raw)
To: Nick Dokos; +Cc: emacs-orgmode
Nick Dokos <ndokos@gmail.com> writes:
> Cecil Westerhof <cldwesterhof@gmail.com> writes:
>
>> At the moment I am using the following formula:
>> #+TBLFM: @<<$4..@>>$4 = $2 - $3 :: @>$2=vsum(@<<$2..@>>$2) ::
>> @>$3=vsum(@<<$3..@>>$3) :: @>$4=vsum(@<<$4..@>>$4)
>>
>> This does what I want, but there are two things that could be improved.
>>
>> - The second, third and fourth formula do exactly the same, only on
>> different columns. Could this be rewritten to one formula?
>>
>
> --8<---------------cut here---------------start------------->8---
> #+TBLFM: @<<$4..@>>$4 = $2 - $3 :: @>$2..$4=vsum(@<<$0..@>>$0)
> --8<---------------cut here---------------end--------------->8---
>
> See (info "(org) References")
>
>> - The line becomes long and hard to evaluate for a person. Is there
>> a possibility to put the formulas below each-other?
>>
>
> I don't believe so but my belief may be out of date. It has been
> discussed before: check the list archives.
Sort of but not really. See "Using multiple #+TBLFM lines" in the
manual.
,----
| Using multiple #+TBLFM lines
| ............................
|
| You may apply the formula temporarily. This is useful when you switch
| the formula. Place multiple ‘#+TBLFM’ lines right after the table, and
| then press ‘C-c C-c’ on the formula to apply. Here is an example:
|
| | x | y |
| |---+---|
| | 1 | |
| | 2 | |
| #+TBLFM: $2=$1*1
| #+TBLFM: $2=$1*2
|
| Pressing ‘C-c C-c’ in the line of ‘#+TBLFM: $2=$1*2’ yields:
|
| | x | y |
| |---+---|
| | 1 | 2 |
| | 2 | 4 |
| #+TBLFM: $2=$1*1
| #+TBLFM: $2=$1*2
|
| Note: If you recalculate this table (with ‘C-u C-c *’, for example), you
| will get the following result of applying only the first ‘#+TBLFM’ line.
|
| | x | y |
| |---+---|
| | 1 | 1 |
| | 2 | 2 |
| #+TBLFM: $2=$1*1
| #+TBLFM: $2=$1*2
`----
--
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can this table formula be done more efficient
2014-06-08 11:53 ` Nick Dokos
2014-06-08 13:07 ` Eric Schulte
@ 2014-06-09 7:04 ` Cecil Westerhof
1 sibling, 0 replies; 5+ messages in thread
From: Cecil Westerhof @ 2014-06-09 7:04 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 902 bytes --]
2014-06-08 13:53 GMT+02:00 Nick Dokos <ndokos@gmail.com>:
> Cecil Westerhof <cldwesterhof@gmail.com> writes:
>
> > At the moment I am using the following formula:
> > #+TBLFM: @<<$4..@>>$4 = $2 - $3 :: @>$2=vsum(@<<$2..@>>$2) ::
> @>$3=vsum(@<<$3..@>>$3) :: @>$4=vsum(@<<$4..@>>$4)
> >
> > This does what I want, but there are two things that could be improved.
> >
> > - The second, third and fourth formula do exactly the same, only on
> different columns. Could this be rewritten to one formula?
> >
>
> --8<---------------cut here---------------start------------->8---
> #+TBLFM: @<<$4..@>>$4 = $2 - $3 :: @>$2..$4=vsum(@<<$0..@>>$0)
> --8<---------------cut here---------------end--------------->8---
>
Works like a charm. Thanks.
>
> See
>
> (info "(org) References")
>
I should study that more diligently.
--
Cecil Westerhof
[-- Attachment #2: Type: text/html, Size: 1899 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can this table formula be done more efficient
2014-06-08 13:07 ` Eric Schulte
@ 2014-06-09 7:06 ` Cecil Westerhof
0 siblings, 0 replies; 5+ messages in thread
From: Cecil Westerhof @ 2014-06-09 7:06 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1339 bytes --]
2014-06-08 15:07 GMT+02:00 Eric Schulte <schulte.eric@gmail.com>:
> Nick Dokos <ndokos@gmail.com> writes:
>
> > Cecil Westerhof <cldwesterhof@gmail.com> writes:
> >
> >> At the moment I am using the following formula:
> >> #+TBLFM: @<<$4..@>>$4 = $2 - $3 :: @>$2=vsum(@<<$2..@>>$2) ::
> >> @>$3=vsum(@<<$3..@>>$3) :: @>$4=vsum(@<<$4..@>>$4)
> >>
> >> This does what I want, but there are two things that could be improved.
> >>
> >> - The second, third and fourth formula do exactly the same, only on
> >> different columns. Could this be rewritten to one formula?
> >>
> >
> > --8<---------------cut here---------------start------------->8---
> > #+TBLFM: @<<$4..@>>$4 = $2 - $3 :: @>$2..$4=vsum(@<<$0..@>>$0)
> > --8<---------------cut here---------------end--------------->8---
> >
> > See (info "(org) References")
> >
> >> - The line becomes long and hard to evaluate for a person. Is there
> >> a possibility to put the formulas below each-other?
> >>
> >
> > I don't believe so but my belief may be out of date. It has been
> > discussed before: check the list archives.
>
> Sort of but not really. See "Using multiple #+TBLFM lines" in the
> manual.
>
That I found. Is handy, but only for debugging. But with the shortened
formula line, it is less of a problem.
--
Cecil Westerhof
[-- Attachment #2: Type: text/html, Size: 2183 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-09 7:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-08 10:19 Can this table formula be done more efficient Cecil Westerhof
2014-06-08 11:53 ` Nick Dokos
2014-06-08 13:07 ` Eric Schulte
2014-06-09 7:06 ` Cecil Westerhof
2014-06-09 7:04 ` Cecil Westerhof
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).