Whenever I try to perform a calculation with a large number result,
26^14
spreadsheets automatically rewrite it in scientific notation, not saving the excluded numbers and cutting it off.
6.451E+19
To get around this, I have to manually type in the answer.
64509974703297150976
This works for displaying the number, but whenever I try to multiply this number in another cell, sheets will perform the calculation on the rounded number form of the scientific notation number.
64509974703297200000 * 2 = 129019949406594000000
This is the number I get instead of the desired:
64509974703297150976 * 2 = 129019949406594301952
Exact numbers are required and this is just getting really frustrating. I would really like to have the answer to stop google sheets from doing this as soon as possible (duh).
Since Google Sheets use JavaScript, you may copy a library and use it.
Here is the link to library with description on how to use:
https://github.com/peterolson/BigInteger.js
Step 1
Go here and copy the code into your Script Editor:
https://github.com/peterolson/BigInteger.js/blob/master/BigInteger.min.js
Step 2
Write your own custom function like this:
function bigIntPow(a, b)
{
return bigInt(a).pow(b).toString();
}
Step 3
Use the function from Sheet:
=bigIntPow(26,14)
The result is text: 64509974703297150976
Related
I have this worksheet where I need to create a checker to determine whether a number (result of dividing the sum of two numbers by another value --DIVISOR) is an integer/does not have decimals. Upon running the said checker, it mostly worked just fine but appeared to detect that a few items are not integers despite being exact multiples of the DIVISOR.
https://docs.google.com/spreadsheets/d/17-idS5G0kUI7JoHAx3qcJOiJ-zofmMrg93hUvZuxPiA/edit#gid=0
I have two values (V1 and V2) whose sum I need to divide by a certain number (Divisor).
I need the OUTPUT to be an integer/whole number. Since the DIVISOR is a multiple of SUM (V1,V2), the OUTPUT is supposed to be a whole number. I also expanded the number of decimal places to make sure that there are no trailing numbers after the decimal point.
However, upon running the MOD function over the OUTPUT, it generated some infinitesimal value.
I also tried TRUNCATING the OUTPUT and getting the DIFFERENCE between the TRUNC and OUTPUT. It yielded the same remainder value as the MOD result.
I downloaded the GSheet and opened it in MS Excel. There seems to be no problem with the DIFFERENCE result, but the MOD function yielded yet another value.
actually, this is not a bug and it is pretty common. its called a floating point "error" and in a nutshell, it has to do things with how decimal numbers are stored within a google sheets (even excel or any other app)
more details can be found here: https://en.wikipedia.org/wiki/IEEE_754
to counter it you will need to introduce rounding like:
=ROUND(SUM(A1:A))
this is not an ideal solution for all cases so depending on your requirements you may need to use these instead of ROUND:
ROUNDUP
ROUNDDOWN
TRUNC
TEXT
I have a Google Sheet with 220 'importdata' functions where each one is pulling a stock quote off a website. The function is just a simple:
importdata("http://<URL>/"&A2)
where A2 contains the symbol like 'GOOG' and the <URL> is the website's URL.
With 220 of these importdata's, I get the error:
"Error Loading data may take a while because of the large number of requests. Try to
reduce the amount of IMPORTHTML, IMPORTDATA, IMPORTFEED or IMPORTXML functions across
spreadsheets you've created."
The errors never go away even if I wait a long time.
See picture showing just a small section of the sheet.
https://imgur.com/a/D7QnWYj
Is there any way to fix this? I would like to put in a random delay for each of these quotes from 1-5 seconds which would fix this problem but I don't know how.
One option, you could implement your own importdata function which would not be limited by the errors above. It would look something similar to:
var response = UrlFetchApp.fetch(url);
var responseData = response.getBlob().getDataAsString();
var data = Utilities.parseCsv(responseData, ',');
return data;
}
and add it in Tools > Script Editor as described in https://www.roelpeters.be/solve-loading-data-may-take-a-while-when-using-importdata-in-google-spreadsheets/
or you could try either one of these https://github.com/search?q=CryptocurrencySpreadsheetUtils instead
They implement a custom function to load the price data in bulk instead of adding 100s of importdata function calls so that you won't have any issues around that.
I've built a function in a Google Sheets that takes pages of data and passes them through to pull metrics from the datasets (which are based on pivot tables of extracted data). All data is pulled programatically, formatted the same way, and named by standardized conventions. I want the standard deviation of all values in the set that are above 100 and in most cases the function I've built works:
=STDEV((IF(INDIRECT($A7&"!B:B")>100,INDIRECT($A7&"!B:B"),""))
However with some smaller datasets STDEV starts throwing errors representative of not being passed enough arguments. I've tried debugging by pulling out pieces, eliminating thresholds, and trying other varieties of STDEV (STDEVA gives me a DIV/0 error, STDEVP and STDEVPA return 0 as the standard deviation) and when I pull out that IF statement it looks like it's returning FALSE as though there's no data in the set that fits the criteria. Except, when I lower the thresholds to >0 or eliminate the threshold entirely it still doesn't work and I know that there are 4+ values in all erroring datasets that are >100. In fact, the same call is summing to non-zero in the column right next to it. What's more, the function works everywhere else but these datasets.
What gives?
For extra info here's a viewable link to the sheet:
https://docs.google.com/spreadsheets/d/1b_456W9UlkuIc6W_FjmFwgycY1xAUkD_W9aMSxG0N6o/edit?usp=sharing
And this is the error the STDEV is throwing:
"Function STDEV parameter 1 expects number values. But '' is a text and cannot be coerced to a number."
Halp
use:
=IFERROR(AVERAGEIF(INDIRECT($A15 & "!B:B"), ">100"))
and:
=IFERROR(STDEV(IF(INDIRECT($A15&"!B:B")>100, INDIRECT($A15&"!B:B"), )))
I am making a scoring system on Google sheets and I am struggling with the logic I need for the final step.
This question might be related, but I can't seem to apply the logic.
There are a number of chemicals tested and for each an amount detected (AD) si given, and each has a benchmark amount allowed (AL). From AL and AD we calculate AD/AL= %AL.
The Total Score (TS) is calculated based on an additive and weighted formula that takes into consideration the individual %ALs, but I won't go into that formula.
The final step is for me to "calculate" the Display Score (DS), which has some rules to it, and this is where I need the logic. The rules are as follows:
If any of the %Als are over 100 (this is will make TS>100 too) and DS should show "100+"
If none of the %ALs are over 99, (TS may be above or below 100) then DS can NOT be over 99, so it should show TS, maxing out at 99.
I want to do this within the sheet itself. I think the correct tool is logic operators IF, AND, OR.
I have made many attempts, these are some: (I am replacing cell references with the acronyms I used above)
=IF(TS>100,"100+",TS)
=IF(OR(AND(MAX(RANGE_OF_%ALS)<100,TS>99),(AND(MAX(RANGE_OF_%ALS)>100,TS>100)),99,"100+"))
I have also tried to think about how I would solve this in Python (just to explore it, I don't want to use Python for the solution). This was my attempt:
if Max%AL<100:
if TS<100:
print(TS)
else:
print("99")
else:
if TS>100:
print("100+")
Those are my attempts at thinking through the problem. I would appreciate some help.
This is a link to a copy of my sheet: https://docs.google.com/spreadsheets/d/1ZBnaFUepVdduEE2GBdxf5iEsfDsFNPIYhrhblHDHEYs/edit?usp=sharing
Please try:
=if(max(RANGE_OF_%ALS)>1,"100+",if(max(RANGE_OF_%ALS)<=0.99,MIN(TS,0.99),"?"))
I've tried doing a custom format, but don't have any luck. I always get a divide by zero error. Ideally, I'd be able to average "1:00.0, 1:30.00, and 2:00.00" and have the function return "90.0" OR "1:30.0"
Can someone help me convert the times into values that the average function can understand?
This is in Google Sheets
Assuming 1:00.0 is in A1, 1:30.00 in A2 etc. The mix of : and , seems not to be accepted as a number format for data entry, so your data is presumably strings. These need first to be converted to numbers. This might be achieved with something like:
=ArrayFormula(value("0:"&A1:A100))
in B1. It not only assumes you have 100 rows of data but also that your data points do not individually equal or exceed one hour unless expressed as 60 minutes or more.
You may want to format the results with Format – Number, More Formats, Custom number format…:
mm:ss.000
though in this format hours are not shown.
In that format the result of:
=average(B1:B3)
should be:
01:30.000
Might not work in old Google Sheets.