When using the UIKeyboardTypeNumberPad option, the button in the bottom left will be a ",". But I want a ".", not a ",".
Is it possible to change this?
Can I add an extra button to the NumberPad?
Or can I change every "," with a "."?
The decimal keypad shows either a period or a comma depending on the user's locale as set in the Region Format setting in the Settings app (Settings -> General -> International).
You don't want to force a period. Users in locales that expect a comma want to see a comma.
If you need to convert a user-entered number string into a number, use NSNumberFormatter to do so. This will properly deal with the user's locale and number format.
Related
The title says it all. One thing I want to avoid is long formulas. If it's more than a single function, something is clearly wrong since this should be a common use case.
I've tried TO_PURE_NUMBER and VALUE
Your question suggests that the value $71.4145 is not a number but a text string. That can happen if your spreadsheet locale is such that it expects comma as decimal mark, or expects a different currency symbol. It will also happen if you have formatted the value as plain text rather than currency.
To convert the text string $71.4145 into the number 71.4145 (seventy-one and change), use regexextract(), like this:
=iferror( value( regexextract( to_text(A2), "[\d.]+" ) ) )
Just use -- to suppress text to equivalent number values. Try-
=--A1
try:
=SUBSTITUTE(A1; "$"; )*1
I'm creating a spreadsheet where one column must hold phone numbers.
Some phone numbers have the plus sign at the beginning of the string.
However, Attempting to enter a '+' at the start of a field activates a feature of Google Sheets.
How do I turn this feature off and get fields to just accept alphanumeric strings?
You should use an "escape" character: '
This way:
'+1234
you can add it as text string like:
="+99 555 653"
Using google spreadsheets to display currency data, with USD as primary field for formula: =LEFT(V10*GoogleFinance("currency:USDEUR"),5)
I cannot figure out how to remove the the USD Symbol ($) from not show up for the additional currencies. It makes no sense to have the **$**xxx being displayed on non-USD data.
I have tried doing Format -> Numbers but none of those options resolve this issue.
The number formats are not working since the LEFT function is converting the value to text. Does this formula work instead:
=SUBSTITUTE(LEFT(V10*GoogleFinance("currency:USDEUR"),5),"$","")
Highlight the cells you want to change. Go to Format --> Number --> More Formats --> Custom number format. Highlight the "$" and delete it (delete the quotes and dollar sign both). Click apply. I have attached before and after pictures.
This seems like it should be simple.
I have a CSV file with multiple currency values (so I'd like to avoid writing a bunch of string-manipulation steps if it can be avoided), and I was excited to see that the CSV File Input step has fields like Currency Separator, decimal symbol, grouping symbol (and mine are the default "$", ".", and ",", respectively).
The documentation describes these as for:
Currency Used to interpret numbers like $10,000.00 or E5.000,00
Decimal A decimal point can be a "." (10;000.00) or "," (5.000,00)
Grouping A grouping can be a dot "," (10;000.00) or "." (5.000,00)
(http://wiki.pentaho.com/display/EAI/Text+File+Input)
But as of the current production version (4.4)... these settings do not seem to have an effect.
Has anyone had success with number masks or similar such that a string like "$10,000,238.48" can yield a number that can be pushed into a database? Anything I do is either "Unparsable" in the text input or "truncated field" error at the insert...
When I do a get fields on a text input step with your example number in it, it sets Currency, Decimal, and Group to '$', '.', ',' respectively, and it reads your number just fine. It also sets a Format string of '$#,##0.00;($#,##0.00)', which it seems is the key piece. The text file input step will examine as many rows as you specify from a CSV and guess the formats for each column.
Here is PDI's number formatting table:
Number Formatting Table
If you have different currency formats mixed in the same column, I would use a UDJE step and this answer:
Parsing a Currency string in Java
Or a JavaScript Step and this answer:
Convert Currency string with JavaScript
to strip out all non digit and non decimal point characters, then pass it through a Select Values step. Note, that this will be very tricky if you have mixed decimal separators in the input column.
I have a column in open office like this:
abc-23
abc-32
abc-1
Now, I need to get only the sum of the numbers 23, 32 and 1 using a formula and regular expressions in calc.
How do I do that?
I tried
=SUMIF(F7:F16,"([:digit:].)$")
But somehow this does not work.
Starting with LibreOffice 6.4, you can use the newly added REGEX function to generically extract all numbers from a cell / text using a regular expression:
=REGEX(A1;"[^[:digit:]]";"";"g")
Replace A1 with the cell-reference you want to extract numbers from.
Explanation of REGEX function arguments:
Arguments are separated by a semicolon ;
A1: Value to extract numbers from. Can be a cell-reference (like A1) or a quoted text value (like "123abc"). The following regular expression will be applied to this cell / text.
"[^[:digit:]]": Match every character which is not a decimal digit. See also list of regular expressions in LibreOffice
The outer square brackets [] encapsulate the list of characters to search for
^ adds a NOT, meaning that every character not included in the search list is matched
[:digit:] represents any decimal digit
"": replace matching characters (every non-digit) with nothing = remove them
"g": replace all matches (don't stop after the first non-digit character)
Unfortunately Libre-Office only supports regex in find/replace and in search.
If this is a once-only deal, I would copy column A to column to B, then use [data] [text to columns] in B and use the - as a separator, leaving you with all the text in column B and the numbers in column C.
Alternatively, you could use =Right(A1,find("-",A1,1)+1) in column B, then sum Column C.
I think that this is not exactly what do you want, but maybe it can help you or others.
It is all about substring (in Calc called [MID][1] function):
First: Choose your cell (for example with "abc-23" content).
Secondly: Enter the start length ("british" --> start length 4 = tish).
After that: To print all remaining text, you can use the [LEN][2] function (known as length) with your cell ("abc-23") in parameter.
Code now looks like this:
D15="abc-23"
=MID(D15; 5; LEN(D15))
And the output is: 23
When you edit numbers (in this example 23), no problem. However, if you change anything before (text "abc-"), the algorithm collapses because the start length is defined to "5".
Paste the string in a cell, open search and replace dialog (ctrl + f) extended search option mark regular expression search for ([\s,0-9])([^0-9\s])+ and replace it with $1
adjust regex to your needs
I didn't figure out how to do this in OpenOffice/LibreOffice directly. After frustrations in searching online and trying various formulas, I realised my sheet was a simple CSV format, so I opened it up in vim and used vim's built-in sed-like feature to find/replace the text in vim command mode:
:%s/abc-//g
This only worked for me because there were no other columns with this matching text. If there are other columns with the same text, then the solution would be a bit more complex.
If your sheet is not a CSV, you could copy the column out to a text file and use vim to find/replace, and then paste the data back into the spreadsheet. For me, this was a lot less frustrating than trying to figure this out in LibreOffice...
I won't bother with a solution without knowing if there really is interest, but, you could write a macro to do this. Extract all the numbers and then implement the sum by checking for contained numbers in the text.