Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Summing values formatted for a different locale
Parent
Summing values formatted for a different locale
A couple of year ago a user of Super User reported difficulties with summing values purporting to be Euros imported to LibreOffice Calc in CSV format.
In the Q the user does not mention the locale settings, but did write "I've used the LEFT function to get just the number part, though that still leaves me with a string." Some sample data was provided, but not its location so assuming the following:
and ,
to separate thousands, .
for decimal, how to determine the sum of the above text-format amounts?
Post
LEFT
returns a text value, so it's working as expected. You might put the LEFT
function inside VALUE
function to convert the value returned by LEFT
into a number. This applies to other spreadsheet apps like Google Sheets.
NOTES:
- Countries that use Euros as their local currency use a dot as a thousand separator and commas as a decimal separator. The above assumes that the spreadsheet is set to a country that uses Euros as currency.
- If your spreadsheet is set to use separators the other way, then use
SUBSTITUTE
to replace the comma with a dot.
References
- Documentation/How Tos/Calc: LEFT function
- Documentation/How Tos/Calc: SUBSTITUTE function
- Documentation/How Tos/Calc: VALUE function
Notes
Based on my answer posted in Super User to the question that inspired this question a few moments ago.
2 comment threads