Paste number in Google Sheets recognizing the proper format - google-sheets

I've changed my locale in Google Sheets (Settings > Locale) to use the Italian format, with the comma as decimal separator, and dot as thousands separator (thus 1.173,00 means one-thousand-one-hundred-seventy-three).
I'm trying to figure out how to paste correctly in a cell a number which comes from the origin as "1.173" and Google Sheets is interpreting that as 3.53.00
Why?
Everything works fine if I include the decimals (pasting "1.173,00") but the source does not includes them, therefore I'm stuck with this problem.
Thank you

Google Sheets is automatically interpreting 1.173 as a duration rather than a number. It reads it as 1 hour and 173 minutes, and automatically corrects it to 3 hours and 53 minutes instead.
Based on my own experimentation, it doesn't seem like there's a fix for this: regardless of what number format is applied to a cell or range before inputting 1.173, Sheets still treats it as a duration. Formatting as plain text allows the cell to display 1.173, but trying to convert that text to a number for use in any sort of calculation (through the use of =VALUE, for example) seems to have issues.

Related

Updating hours with text and dashes in Google Sheets

I am trying to figure out how to add +8hours to a schedule formatted with a text in front and a dash in between the hours. Please see example below:
Training 01:45AM - 02:45AM
Convert that time to +8 hours.
Training 09:45AM - 10:45AM.
I just cant seem to figure out the best formula to use in this scenario.
Supposing the raw data string from your post were in A2, this should work:
=REGEXREPLACE(REGEXREPLACE(A2,REGEXEXTRACT(A2,"(\d.+M) -"),TEXT(VALUE(REGEXEXTRACT(A2,"(\d.+M) -"))+TIME(8,0,0),"hh:mmAM/PM")),REGEXEXTRACT(A2,"- (\d.+M)"),TEXT(VALUE(REGEXEXTRACT(A2,"- (\d.+M)"))+TIME(8,0,0),"hh:mmAM/PM"))
In short, this formula uses REGEXEXTRACT to pull each time from the string, convert it to a value, add eight hours, convert it back to TEXT and finally reinsert that transformed substring back into the original string with REGEXREPLACE. Because this happens twice, you'll see two such setups, one wrapped within the other.

Why is this Google Sheets Concatenate Formula giving me weird results?

I'm trying to use Google Sheets to concatenate a bit of data. It works 90% of the time, however on certain numbers, I get an odd result. I have to copy the result of this data and paste it into a financial program in a specific format and am using the concatenate formula to do this. The format the program requires is that each field be separated by one period, even if it is a dollar amount as the program will automatically move the decimal point two places to the left while it is evaluating the information. The issue is that on some numbers the formula adds two periods between the fields, which stops the evaluation of the data in our financial program.
Here is a screenshot including the formula
You can see that it works with most numbers in the amount column, but with two of the amounts and several others, it adds two periods after the amount.
Would you please take a look at this and see if you can help me find the issue?
Thank you!!!!
Looks like it's an existing floating point calculation error in Google Sheets, the multiplication by 100 did not return exact value for certain numbers but with extra very small decimal. That's why there's an additional period on the result.
As a workaround, use ROUND() upon multiplying by 100 to "snap" it to an integer.
Sample:
References:
Floating Point Calculation Error
use just:
=B2&"."&ROUND(C2*100)&"."&D2

How do i stop google sheet from auto-calculation?

I have a sheet that will record delivery information. However one of the record we have right now have a barcode that start with equal (=) symbol(=00000-00). So whenever we fired our barcode reader at it. it return as 5 digits number (10000) with minus calculation instead of our office-use 7 digits number format. (10077-77)
From what i know, In excel you can turn auto-calculation off as simple as turning format into text for use manual setting for calculation. However that doesn't seems to be the case here for Google Sheet. Is there any workaround for this? I tried =right(B2, len(B2)-1) but all it does is removing first number out and ignore equal symbol entirely.
I believe the best workaround is to treat it like a string:
You also have the option of displaying formulas:
Yet if you use a value of =0000-00 or something with starting zeros, it will not display the zeros:

Convert text to number in Google Sheets

I'm reading currency values from a website and I'd like to do some calculations with these numbers. They come in this format:
$7,821.24
Here's an example file:
https://docs.google.com/spreadsheets/d/1vHEH_m16KXcDh7hY_BVG9lur1huFjWOnx5bWtgrdGdA/edit?usp=sharing
Now for some reason neither VALUE() and TO_PURE_NUMBER work for me (Can't parse to numberic value, telling me it's a text value).
My guess is that the comma and the $-sign confuse the formula, is there anything I can do to format this correctly? The dollar sign always appears in the values but the comma only appears separating thousands of values.
I just started using Sheets for this so I absolutely have no clue. Would really appreciate if someone could help me out.
Thanks for your time!
Issue:
It's a locale problem. The value coming from IMPORTXML is formatted as in United States locale, so your spreadsheet (which uses a different format) cannot convert it.
Solution #1. Changing locale:
If the spreadsheet locale is changed to United States or others with the same format (via selecting File > Spreadsheet settings and setting the mentioned locale), the retrieved value will be a number, and you can work with it without using any other formula.
Solution #2. Formula:
If changing the locale is not an option, one possible way to convert the value to a valid number in your locale is the following formula:
=SUBSTITUTE(SUBSTITUTE(RIGHT(A2;LEN(A2)-1);",";"");".";",")
Changing locale didn't work in my case. But I was able to split the number which google sheet isn't detecting as a real number. So split it with "," and "." and any currency sign you may have, and then combine individual values for desired output

How to prevent Google Spreadsheet from interpreting commas as thousand separators?

Currently, pasting 112,359,1003 into Google Sheets automatically converts the value to 1123591003.
This prevents me from applying the Split text to columns option as there are no commas left to split by.
Note that my number format is set to the following (rather than being Automatic):
Selecting the Plain text option prevents the commas from being truncated but also prevents me from being able to use the inserted data in formulas.
The workaround for this is undesirable when inserting large amounts of data: select cells that you expect to occupy, set to Plain Text, paste data, set to back to desired number format.
How do I disable the automatic interpretation by Google Spreadsheet of the commas in my pasted numeric values?
You can not paste it in any number format, because of the nature of numerical format types. It will parse it into an actual number and physically store it in this format. Using plaintext type, like you are, is the way to go for this.
However, there are some options to perform these tasks in a slightly different way;
- you might be able to use CSV-import functionality, which prevents having to change types for a sheet.
- you can use int() function to parse the plaintext value into an int. (and combine this with lookup functions).
TEXT formatting:
Use ' to prepend the number. It'll be stored as text regardless of actual formatting.
Select the column and set formatting as `plain text.
In both the above cases, You can multiply the resulting text by 1 *1 to use in any formula as a number.
NUMBER formatting:
Keep Number formatting with ,/Automatic.
Here, though split text to columns might not work, You can use TEXT() or TO_TEXT()
=ARRAYFORMULA(SPLIT(TO_TEXT(A1:A5),","))

Resources