emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Izzie <ml_orgmode.kapush@antichef.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: tables: is it possible to use a comma instead of a period as a number delimiter
Date: Mon, 16 May 2011 12:05:31 +0200	[thread overview]
Message-ID: <BANLkTinZz9-NVKtaer_qcwFFnXPT3y8jUA@mail.gmail.com> (raw)
In-Reply-To: <loom.20110516T005001-831@post.gmane.org>

Hi Izzie

The only direct solution I can think of now is with Emacs Lisp for
number/string conversion and ./, replacement:

#+begin_src emacs-lisp :results silent
  (defun com2num (com)
    "convert number string with comma like \"2,3\" to number like 2.3"
    (string-to-number (replace-regexp-in-string "," "." com)))
  (defun num2com (fmt num)
    "convert number like 2.300001 to number string with comma
like \"2,3\", formatted with fmt like \"%.1f\""
    (replace-regexp-in-string "\\." "," (format fmt num)))
#+end_src

|  <r> |
|------|
| 10,2 |
|  3,0 |
|  5,6 |
|------|
| 18,8 |
#+TBLFM: @5='(num2com "%.1f" (apply '+ (mapcar 'com2num '(@2..@4))))

Michael

On Mon, May 16, 2011 at 01:12, Izzie <ml_orgmode.kapush@antichef.net> wrote:
> I started using org tables including a column of numbers formatted the European
> way with a comma instead of a period, for example 127,43 for 127.43.
>
> When I use a formula to sum the whole column it expect a period and ends up with
> a false calculation. I'd revert my numbers to the American format but this table
> is used for accounting so it's not an option. Going through the manual didn't
> provide any help.
>
> Is there a way to have org use the european format or am I to ditch the formula
> and make use of C-c + to manually calculate the sum ?

  reply	other threads:[~2011-05-16 10:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-15 23:12 tables: is it possible to use a comma instead of a period as a number delimiter Izzie
2011-05-16 10:05 ` Michael Brand [this message]
2011-05-16 11:26   ` Christian Moe
2011-05-16 12:20     ` Carsten Dominik
2011-05-16 13:23       ` Christian Moe
2011-05-16 17:54         ` Carsten Dominik
2011-05-16 18:08           ` Nick Dokos
2011-05-16 20:46             ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTinZz9-NVKtaer_qcwFFnXPT3y8jUA@mail.gmail.com \
    --to=michael.ch.brand@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ml_orgmode.kapush@antichef.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).