Easy Calculator

How can i sum a list that i all ready copy to my clipboard, but i need to replace from "." to "," to have a number right? not a text.

i know that i can {=split({clipboard}, "\n")[1]}{key: tab}{=split({clipboard}, "\n")[2]}{key: tab}{=split({clipboard}, "\n")[3]}{key: tab}...
but how can i sum them with the replace funtion and make it work no matter how many elements i add to clipboard (10 max) with $dd.ddd / $ddd.ddd / $d.ddd.ddd. It seems to be easy but I can't make it.

Clipboard list
$285.600
$196.350
$52.955
$24.930

Here is an example:

{=sum(map(split({clipboard}, "\n"), v -> replace(replace(v, "$", ""), ".", "")))}

This snippet will remove dots and dollar signs before summing up all the numbers. The output will be also a number without dots inside.

1 Like

Thanks you so much, quick question. If i want to add one more replace funtion ".", "" to the original how would it be? sum(map(split({clipboard}, "\n"), v -> replace(replace(v, "$", ""),".", "")))

Do you mean removing all the dots from the clipboard content? You could do it like this:

{=sum(map(split(replace({clipboard}, ".", ""), "\n"), v -> replace(v, "$", "")))}

No, what i mean is removing the "comas" too. In Chile we use as thousands separator the dots not the comas.

$1.477.980
$147,798
[Error - Cannot convert "147,798" to a number.]
=$1.625.778

You can do it like this:

{=sum(map(split(replace(replace({clipboard}, ".", ""), ",", ""), "\n"), v -> replace(v, "$", "")))}