I'm creating a table with percentages and calculating a simple sum of a column. The only thing left is to show the result of the formula as a percentage.

Here is my MWE:

| Element |   $ |
| E1      | 35% |
| E2      | 65% |
| Total   |  1. |
#+TBLFM: @>$>=vsum(@2..@-1)

My question is: how can I show the result of the formula as 100% instead of 1?

The percentage signs are important because the table will be exported to latex.

  • Off the top of my head, I would have said: by applying a calc format using the ;<format> specification described here - but I don't know what format that would be. I think calc can do that but I don't know if Org mode implements it. – NickD Sep 24 '20 at 1:38

After a bit of trial and error, it seems that something like this might work:

| Element |    $ |
| E1      |  35% |
| E2      |  65% |
| Total   | 100% |
#+TBLFM: @>$>=vsum(@I..II)*100;%.0f%%

You always think of the entries as the corresponding decimal fraction (35% = 35/100 = 0.35 etc) and the result is the sum of the fractions, so you convert the fraction into the percentage by multiplying by 100 and formatting the result as a float with, in this case, 0 digits after the decimal point and appending a % sign (but a % sign has special meaning in format strings so to get a literal percent sign, it needs to be escaped with another percent sign).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.