I have a view where there is a column displayed numeric values. Earlier the field which displayed this numeric value was of type text, but later I changed it to Number. As I want the column to display this numeric value with 3 decimal places, I updated the column properties to display 3 decimal places. Now the new documents show the column with 3 decimal places, but the older documents still do not show 3 decimal places.
Is there any function that I can use to make the number display 3 decimal places?
If the value is 1, then it must show 1.000, if 0.8 then 0.800.
Change your column formula to
#ToNumber(YourField)
This way old values gets converted to a number and will be shown with 3 decimal places too.
YOu could also either write an agent that changes the field type of that specific field in all document to number, or you could use a tool like NoteMan.Editor (from MartinScott) or scanEZ (from Ytria) to do the same. As a developer/admin, you should have at least one of those tools, preferably both.
I blogged about them a while back, if you want to learn more:
http://blog.texasswede.com/stuff-i-use-every-day-siued-noteman/
http://blog.texasswede.com/my-favorite-tools/
I don't work for either of the companies, I am just a happy user of their tools.
Related
This question already has answers here:
Query is ignoring string (non numeric) value
(2 answers)
Closed 5 months ago.
I am working on some data where i have to import the raw data from sheet Prepaid to the Master sheet but am seeing that certain number cells dont get imported like in cell B18 in sheet named Master. If I convert the raw data cell to number it works but it converts 11892667013478301 to 11892667013478300 leading to a mismatch. Is this is a size restriction on the number
Sheet is below
https://docs.google.com/spreadsheets/d/12y5h6NYArpEctQ2FD-AXJrqZcQydnEd5BjrOALMJEGI/edit?usp=sharing
From QUERY docs:
In case of mixed data types in a single column, the majority data type determines the data type of the column for query purposes. Minority data types are considered null values.
Since most values in your column end with two 0s, they don't reach the digit limit of 15, and are treated as numbers. The values that reach 15 digits are treated as string values, and since those are a minority in the column, they are considered null values.
To avoid this, you can force all values in the column to be treated as strings via TO_TEXT, and apply the QUERY to that.
=QUERY(ARRAYFORMULA(TO_TEXT(Prepaid!E:F)),"select * where Col1 is not null")
I'll delete my other answer, since yes, the issue seems to be that you are hitting the maximum number of significant digits, 15, for a number in Google Sheets. You can prove this by tring to add any small number to any of your (numeric) cells in Prepaid!F - the number doesn't increase, since it can't display any more significant digits.
The majority of your values are 15 signifcant digits plus two zeroes on the end. But F18 and F28 end in 01, not 00, so they are treated as strings. Forcing them to a number "discards" the last two significant digits, making them 00.
Perhaps the easiest answer for you is to force all of columns E and F to be text strings, rather than numeric values, and then they can all be dealt with equally, such as running queries against them.
Let me know if this helps at all.
We are using Google Forms to collect data on our students. They use the same Google Form for all students, but as part of the form, they are asked the students name.
The data that ends up being collected you can see on the tab Form Responses 1 on the Google Sheet linked here.
I am attempting to use ImportRange to create a tab for each of the students. The formula that I am using for just one of the students is...
=QUERY(IMPORTRANGE("1nJANDP1fiQunxfxEf-EjwJrnIRICv6kLhYYY9XBXtD4", "Form Responses 1!A:I"),"SELECT * WHERE Col3 = 'Adam N.'")
You can take a look at the tab called Adam N. and you'll see it is kind of working.
One thing that doesn't seem to be working is when there is a text value in columns E-I, that text value doesn't end up showing on the Adam N. tab. Any ideas how I can get both the numbers and the text values to show up?
The other thing that seems to be a problem is the fact that on the Adam N. tab, the very first row has the same headers as the Form Responses 1 tab, but it also has the very first line of data. Any way to remove that?
Importrange is not needed since you are 'importing' from within the same spreadsheet. Also, I'd recommend using the (optional) header argument in query().
It is often noted that users are tempted to mix data types within a column. The query() function will give undesirable output. If a column is intended for numeric values then only numerical values must reside in that column. Date columns must only contain dates and text columns only contain text values.
This does not mean that numbers cannot appear in a text column as long as they are in a text format. So it is important to plan the columns in a table to make sure this rule is maintained regardless if the data table is created manually or via submissions from a Google Form.
Generally, the query() function will assume the greater number of cell types in a column to be that data type. For example, if there are 100 numbers and 20 text values in the same column then a numeric value will be assumed for that column. There is a good chance the text values will just be ignored. One way to avoid this, would be to convert everything to text.
See if this works
=ArrayFormula(QUERY(to_text('Form Responses 1'!A:I),"WHERE Col3 = 'Adam N.'", 1))
There is a ton of examples of generating random numbers in LUA that have no duplicates, and just a standard math.random(x,y) can get a set of random whole numbers in a range....
... but I am having trouble finding a set of random numbers between a range, but allowing x amount of duplicates. For my immediate needs I can allow 1 set of duplicates, but it would be great to have code where you can set "duplicate value" to anything for future projects.
Example : I want to generate a list of 10 whole numbers between 1-10... each value can be anything between 1-10, but any one number can only be generated and added to the list twice.
Example Result: 1,1,2,4,5,5,7,7,8,9
In this example result math.random() tried to spit out 3 or more of the same number, but the code makes it go back and try again if it has already produced 2 of the same number.
Thanks in advance!
You can use "merge trick":
Create "unical" array of numbers for 5 (10/number of dublicats) elements: 1,2,5,7,9
Repeate #1
Merge arrays.
You can generalize it with paramers of minValue, maxValue, totalNumber, numberOfDublicates, but will need to little more code for handling 10/3 problems and maxValue < totalNumber.
Generate a sequential list of non-random numbers between a range with
no duplicates.
Add them to a table, but add each number X amount of times, where X
is the total amount of duplicates allowed. So we know have a table x
times as long with each individual number listed X amount of times.
Shuffle the table, or generate a list of random numbers or both.
Then simply extract the numbers from the table using the generated
numbers as the numeric key value for the "duplicate" table.
You can store anything at those key values so this works for
anything.. not just numbers.
In an old application, I have a table (Paradox DB) that contains a numeric "number" field.
The user can enter the "number" in two ways:
Example:
1- 123
or
2- 000123
I have not yet found the trick to record a recording starting with zeros.
How to save zeros in DB as: 000123 please?
Thank you for your help.
You cannot store leading zeros in a numeric column. If you need to retain leading zeros then you must use a text column, or perhaps a separate column to contain the number of leading zeros.
This isn't to do with storage, it is to do with display. If the database is that old the value is probably stored internally as two bytes, and so 'leading zeros' is meaningless in terms of storage. The alternatives are to store data as a string (which happens to contain numeric digits) or format the (text) display using standard formatting routines.
I have a number field called Days and an editable names field called Names ( which allows multiple values ).
Let say that Days=1 and Names=Mike/Rock, Tom/Rock, Dean/Rock.
I want to display them in a column view like this:
1
Mike
Tom
Dean
I tried it with #NewLine, but no luck for me.
I also created a computed (hidden) field test with the following formula as default value:
#Text(Days)+#NewLine+#Implode(#Name([CN];Names);#NewLine)
It seems to be the wanted form for me, but when I just put test in a column default value, it shows nothing.
I appreciate your time.
Try to set your test field to #text(days):Names. This should create a multi-value field (as opposed to a single string which your test formula produces).
Then, set the multi-value separator of the column style to Newline, and adjust the number of rows to match the expected number of values.
In a view we get only one row for one document. Multiple values are therefore shown in one row only with multi value separator.
Eclipse view may perhaps help.