emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to exclude colum titles from calculations
@ 2023-03-09 10:45 Uwe Brauer
  2023-03-09 12:28 ` Fraga, Eric
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Brauer @ 2023-03-09 10:45 UTC (permalink / raw)
  To: emacs-orgmode


Hi 

Please take this example: 

|-------+-----------+-------------+-----------+----------|
|       | Account 1 | 1/4 part of | Account 2 |      1/4 |
|-------+-----------+-------------+-----------+----------|
| Item1 |    224999 |             |    224999 |          |
| Item2 |    269403 |             |    269403 |          |
| Item3 |           |             |           |          |
| Item4 |           |             |           |          |
| Item5 |     10300 |     2575.00 |           |          |
#+TBLFM: $3=if(typeof(0.25*$2) == 12, string(""),0.25*$2); E f-2::$5=if(typeof(0.25*$4) == 12, string(""),0.25*$4); E f-2

C-c C-c 

Leads to the expected 


|-------+-----------+-------------+-----------+----------|
|       | Account 1 | 1/4 part of | Account 2 |      1/4 |
|-------+-----------+-------------+-----------+----------|
| Item1 |    224999 |    56249.75 |    224999 | 56249.75 |
| Item2 |    269403 |    67350.75 |    269403 | 67350.75 |
| Item3 |           |             |           |          |
| Item4 |           |             |           |          |
| Item5 |     10300 |     2575.00 |           |          |
#+TBLFM: $3=if(typeof(0.25*$2) == 12, string(""),0.25*$2); E f-2::$5=if(typeof(0.25*$4) == 12, string(""),0.25*$4); E f-2


However when I have one line on top of the table 


|       |      What |             | This      |     |
|-------+-----------+-------------+-----------+-----|
|       | Account 1 | 1/4 part of | Account 2 | 1/4 |
|-------+-----------+-------------+-----------+-----|
| Item1 |    224999 |             |    224999 |     |
| Item2 |    269403 |             |    269403 |     |
| Item3 |           |             |           |     |
| Item4 |           |             |           |     |
| Item5 |     10300 |     2575.00 |           |     |
#+TBLFM: $3=if(typeof(0.25*$2) == 12, string(""),0.25*$2); E f-2::$5=if(typeof(0.25*$4) == 12, string(""),0.25*$4); E f-2

Then C-u C-u C-c C-c leads to 


|       |      What |                              |      This |                              |
|-------+-----------+------------------------------+-----------+------------------------------|
|       | Account 1 | mul = 12 ?  : 0.25 Account 1 | Account 2 | mul = 12 ?  : 0.25 Account 2 |
|-------+-----------+------------------------------+-----------+------------------------------|
| Item1 |    224999 |                     56249.75 |    224999 |                     56249.75 |
| Item2 |    269403 |                     67350.75 |    269403 |                     67350.75 |
| Item3 |           |                              |           |                              |
| Item4 |           |                              |           |                              |
| Item5 |     10300 |                      2575.00 |           |                              |
#+TBLFM: $3=if(typeof(0.25*$2) == 12, string(""),0.25*$2); E f-2::$5=if(typeof(0.25*$4) == 12, string(""),0.25*$4); E f-2

Which is terrible.

Any idea how to avoid this?

Thanks and regards

Uwe Brauer 


-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/



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

* Re: How to exclude colum titles from calculations
  2023-03-09 10:45 How to exclude colum titles from calculations Uwe Brauer
@ 2023-03-09 12:28 ` Fraga, Eric
  2023-03-09 13:58   ` Uwe Brauer
  0 siblings, 1 reply; 3+ messages in thread
From: Fraga, Eric @ 2023-03-09 12:28 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

I make extensive use of the advanced features of the spreadsheet in org
tables, specifically having a first column that indicates which rows
should be calculated or not.  Check out the org info manual

(org) Advanced features

and the token you want in the first column would be '#' for those rows
that should be calculated.

this will allow you to exclude the second row from any updates.

-- 
: Eric S Fraga, with org release_9.6.1-278-ge52c53 in Emacs 30.0.50

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

* Re: How to exclude colum titles from calculations
  2023-03-09 12:28 ` Fraga, Eric
@ 2023-03-09 13:58   ` Uwe Brauer
  0 siblings, 0 replies; 3+ messages in thread
From: Uwe Brauer @ 2023-03-09 13:58 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "FE" == Fraga, Eric <e.fraga@ucl.ac.uk> writes:

> I make extensive use of the advanced features of the spreadsheet in org
> tables, specifically having a first column that indicates which rows
> should be calculated or not.  Check out the org info manual

> (org) Advanced features


Aha, thanks 
meanwhile I tried

|   |       |      What |           |      This |           |
|---+-------+-----------+-----------+-----------+-----------|
| ! |       | Account 1 | Account 1 | Account 2 | Account 2 |
|---+-------+-----------+-----------+-----------+-----------|
|   | Item1 |    224999 |  56249.75 |    224999 |  56249.75 |
|   | Item2 |    269403 |  67350.75 |    269403 |  67350.75 |
|   | Item3 |           |           |           |           |
|   | Item4 |           |           |           |           |
|   | Item5 |     10300 |   2575.00 |           |           |
#+TBLFM: $4=if(typeof(0.25*$3) == 12, string(""),0.25*$3); E f-2::$6=if(typeof(0.25*$5) == 12, string(""),0.25*$5); E f-2

Or / instead of !, the problem is then this row is not exported.


So you propose

|   |       |      What |           |      This |           |
|---+-------+-----------+-----------+-----------+-----------|
|   |       | Account 1 | Account 1 | Account 2 | Account 2 |
| # | Item1 |    224999 |  56249.75 |    224999 |  56249.75 |
| # | Item2 |    269403 |  67350.75 |    269403 |  67350.75 |
| # | Item3 |           |           |           |           |
| # | Item4 |           |           |           |           |
| # | Item5 |     10300 |   2575.00 |           |           |
#+TBLFM: $4=if(typeof(0.25*$3) == 12, string(""),0.25*$3); E f-2::$6=if(typeof(0.25*$5) == 12, string(""),0.25*$5); E f-2

Which works nicely, thanks







-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

end of thread, other threads:[~2023-03-09 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09 10:45 How to exclude colum titles from calculations Uwe Brauer
2023-03-09 12:28 ` Fraga, Eric
2023-03-09 13:58   ` Uwe Brauer

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