I have a table like this:
|------+--------|
| Item | Amount |
|------+--------|
| A | 100 |
| B | 20 |
| A | 120 |
| C | 40 |
| B | 50 |
| A | 20 |
| C | 16 |
|------+--------|
and then I need to sum each element in a different table:
|------+-----|
| Item | Sum |
|------+-----|
| A | 240 |
| B | 70 |
| C | 56 |
|------+-----|
I tried using vlookup and the remote link in this table, but I can’t summarize the resulting list, for example:
#+TBLFM: $2=vsum((vconcat (org-lookup-all $1 '(remote(ENTRY,@2$1..@>$1)) '(remote(ENTRY,@2$2..@>$2)))))
But he does not give an answer.
So, I have to use a place holder to store the resulting list, and then sum it up:
|------+--------------+-----|
| Item | Placeholder | Sum |
|------+--------------+-----|
| A | [100 120 20] | 240 |
| B | [20 50] | 70 |
| C | [40 16] | 56 |
|------+--------------+-----|
Is there a better solution for this?
source
share