Not calculating correct number or refreshing - google-sheets

I am using Google Sheets and have just noticed a very worrying issue.
I have a situation where I have a number (for example 4.99) in the left column and the right column through a series of formulae may come out as 30% or so. I changed the number in the left to 5 and the number is the right column jumped to 50% or so (highly unexpected to see such a large jump for such a small increase, so I decided to investigate). When I typed 4.99 back into the left box, the result in the right was just slightly lower than the 50% or so.
I then checked several other numbers in the left column. It turns out that this was the same for all of them. I.e. the number in the right column was not calculating properly until I changed the number in the left column and pressed enter. How is this possible? I have never had this problem with Excel and I don't know what to do other than to migrate back to Excel as I am now doubting the reliability of all the spreadsheets I have on Google Sheets.
Has anybody else come across this problem?

I managed to figure it out moments after posting this.
In the column for some reason some of the cells were considered numbers and some text. I performed an if statement (<10), which came out FALSE for all cells considered text.
Quite dangerous - surely the cell on the right should show an error and not assume FALSE?

Related

I'm looking for a Google Sheet array function to add specific increments in each row

Here's how it looks.
Hi. I'll try to be as specific as possible about this :)
I'm making a Google Sheet page similarly to a game character progression, that will automatically fill up based on data from other sheets: specifically, these "EXP" bars fill up with values based on the hidden cell A5.
For instance, the cells from D5 to BA5 represent LV1.
As the function shows, every time the value in A5 reaches an even number (for LV1, it's all even numbers from 2 to 100), one of the slots will fill up with a number, that with conditional formatting, will change the color of the cell and make it look like an actual exp bar filling up.
I'm using the function =COUNTIF(A5,">=2") and manually changing it to ">=4", ">=6" etc until ">=100" for the first bar. The second bar will have its 50 cells with all even numbers from ">=102" to ">=200".
So, to get to the question: is there an array formula that facilitates the process of filling a great amount of these bars with functions, without changing them all manually? Even automating *some *of this process would be great. Besides it being tedious, it leaves a lot of room for human error.
Thank you in advance to whoever's got an answer.
P
I haven't tried much as at the moment I am very confused by the vast amount of options array formulas provide. I have 48h of experience in the matter.
I suggest you to use the values of columns and rows here as helpers to do calculations. If you know that every column adds 2 and every row adds 100 you can set a formula like this for the whole range (select the whole range and add just one rule of conditional formatting):
=$A$5>((Column(D5)-3)*2+(Row(D5)-5)*100))
You use $symbol to make A5 steady and D5 value will "move" to each cell for conditional formatting, so you don't have to make an ARRAYFORMULA for this

Inspecting text in Google Sheets from vlookup without destroying formula, text wrapping, or changing column width to "fit to data"?

This has been an issue I've lived with for a really long time, without ever really figuring out a reasonable solution. I feel like there must be one, however.
I do a lot of spreadsheet preparation for non-technical users. In my current situation, it involves a selection committee that needs to view candidates' submissions. The problem is, each candidate's responses vary quite a bit in length and size. I am using very basic VLOOKUP's to populate a series of columns so that when a given applicant is chosen from a dropdown menu.
Here is the dilemma, to me it feels like there must be a way to view the entire content of a vlookup result WITHOUT having to change row/column width/height to "fit to data" or some arbitrary huge number. For normal text boxes that get cut off, you can just double click the cell, and it neatly displays the entire text content for you. When I try to do this with a vlookup formula, double-clicking just displays the vlookup formula itself. The only way around this I've found is copying the cell, then doing paste-special and choosing "value only". But doing this destroys the vlookup formula, requiring a quick control-Z to undo afterwards -- something fine for me, but not something I can't reliably ask my end users to know to do.
Put succinctly, is there no other way to display/access the entire text content of a cell that is cutoff, if the content is the result of a v or hlookup formula? A way, that is, without value pasting over the formula, or having to adjust the column width and/or choose 'wrap text' and changing the row height?
I was hoping there might be some way to get the contents of the vlookup to appear in something like a tooltip popup if you hover over the cell? Or some other solution.
move your vlookup formula up a row like if its now in B2 and the output of vlookup is 1 column put this in B1:
={""; ARRAYFORMULA(IFNA(VLOOKUP(...)))}

Google Sheets Formula Sometimes does not work with Merged Cells

So I have created an invoice spreadsheet in Google Sheets and have used merged cells extensively in order to create a cleaner look for the invoice.
Here is the problem that I am having: sometimes, my simple subtraction formula does not give me a correct result. The formula is supposed to subtract the Unsold balance (cell V27) from the Beginning Balance (cell R27).
Again, there is nothing wrong with the formula itself, as it works correctly 99% of the time, but every now and then, it just gives me an answer matching the Beginning Balance.
Also here is a link to a copy of the spreadsheet for anyone willing to take a look. https://docs.google.com/spreadsheets/d/1bf_QE-u36mo4AKyqg7Dk11gwoR0p5g0qveIazR83Xbk/edit?usp=sharing
Has anyone else ever had this situation happen to them? What could possibly be causing it, and more importantly, how can it be fixed to be more reliable?
Those of us who work professionally developing Sheets solutions have a few basic rules that we follow and encourage others not to break. Among them is "Never merge cells anywhere that calculations or comparisons will be (or ever might be) performed or assessed."
While what you're seeing might seem to be a glitch, I wouldn't call it that. Merged cells don't really get rid of the cells you don't see. For instance, your cell R27 doesn't "get rid of" cells S27, T27 and U27. It just holds them in memory, presumably empty. But remember that, inside Sheets' "memory," it doesn't "see" a grid. It's just 1's and 0's. When a grid is new and no cells are merged, Sheets "finds" each cell (using the best analogy I can give) counting over and down by 1's and 0's that are very small and tightly packed. Hold that thought...
Also note that many people are surprised when they have multiple complex calculations going on and get a returned answer that is off from what they expect in a cell further down the calculation chain. This is because Sheets uses floating decimal points. For instance, "one divided by three" is about 0.333. But in reality, that extends very far out: 0.33333333333333333333. But that can't go on forever or Sheets wouldn't be able to run. So at some point it gets truncated. Eventually, those extra decimal-extras will start to add up and bump numbers up (or down) by small degrees. All of this is handled by the same 1's and 0's that run everything else.
Back to merged cells. Finding and accurately "reading" merged cells gets less accurate the more of them you merge, because the process is relative to other cell locations in memory. After a while, the "floating decimal point" nature of Sheets starts to lose track, especially (I've observed) if you've got merged cells using the same sort of relative formula reference that you're using (e.g., a lot of your stacked merged cells are referencing yet another merged cell: BB2. So (again by analogy), Sheets is trying to "guess where it is by using clues." Perhaps it found something correctly in merged cells Z-AA-AB-AC23 that referenced merged cells BB2-BB3-BC2-BC3; but that time, you asked it to add merged cells R-S-T-U23 and V-W-X-Y23 and subtract merged cells V-W-X-Y24 ... where in the following set of merged cells, Z-AA-AB-AC24, you still asked for the BB2-BB3-BC2-BC3 reference but not the V-W-X-Y24 subtraction. And so on...
To add to this, you've got row heights changed all over the place. Some are set to specific heights, while others are fit to data.
You get the picture.
If Sheets is trying to find things by moving over and down from cell A1, but there is no regularity, sometimes, it just throws it's hands up and says, "Where the h-double-hockey-sticks am I anymore?" When you then reload the sheet or delete and replace the formula, it starts out at A1 again and plays Chutes and Ladders on the broken board and might shift one "floating" teeny-weeny 1 or 0 a different way from last time... and find what you wanted it to find again.
You also-also wind up with a sheet that is 56 columns across, when you probably only needed it to be 12 or 15. Likewise, you've extended the number of rows beyond what it needed to be. So you're slowing down your processing by a lot.
THE SHORT VERSION:
As nice as merged cells might look, they are a computing nightmare. I've been working with spreadsheets since they were invented, and I've literally never had a need for merged cells (though I've occasionally used them in areas that are purely aesthetic).
THE SOLUTIONS:
1.) Remake the sheet without merged cells.
-or-
2.) Try encompassing all of the merged-but-hidden cells in your calculations. This at least gives Sheets a wider net to cast. For instance, in your example above, you reference this formula:
=IF($BB$2<>"Rental","",R27-V27)
Try (where possible) to include the whole range you merged:
=IF($BB$2<>"Rental", "", SUM(R27:U27) - SUM(V27:Y27) )
Technically, you could also include all cells in the BB2-BB3-BC2-BC3 merge:
=IF(AND($BB$2<>"Rental", $BB$3<>"Rental", $BC$2<>"Rental", $BC$3<>"Rental"), "", SUM(R27:U27) - SUM(V27:Y27) )
However, try the shorter route with just the SUMmed merged ranges and see if it holds up. If so, stick with that. If not, go with referencing every cell in ranges you merged.
You've clearly put a lot of work into setting up this sheet. So I'm sure this isn't the easy answer you were hoping to hear. But I hope it does give you some direction for next steps.
For me, the simplest solution is to lock-reference the uppermost cell of the merged cells.
Instead of referencing in the top formula as B2, reference as $B$2. This way, your formulas in other cells will reference the same value as required.
USE LOCK-REFERENCING:
$B$2

Filter and Query formulas not working properly in Google Sheets

I have a problem with google sheets, where sometimes the filter function (green square) won't work in some rows, always the last ones, but not always the same quantity. Sometimes will load all of them, sometimes none. It doesn't throw an error, just leave blank cells.
Other error is with the query on the blue square, it has no conditions (its just =query(range) cause I want to bring all the data) the problem is what you see on yellow background (the yellow is just a conditional format), there is data to bring on the right, but doesn't load it on the left, it is just weird. Sometimes I load the formula again and it will load more rows, sometimes less rows.
Can you tell me if there is some way to solve it? it is just 150 rows, and I've worked with 1000 or more with these formulas, and over 12000 with query and filter.
Thanks in advance.
The pic:
Solved!
I had activated the iterative calculations on the Spreadsheet for some tests. It appears it limits the capacity of iteration of filter an query formulas.
Now it works like Christmas.
Thanks community

How to average the last seven values in a column?

I am trying to find the average of the seven most recent entries in a row, as seen in
this
spreadsheet.
I found a few questions similar to mine, but I am still pretty confused on how the answers work. The questions similar to mine can be found on the left side of my spreadsheet.
I think that the formulas would work for me with a few simple adjustments of which values to use, but I can't seem to figure it out. I would really appreciate if someone could explain one of the existing answers or come up with another one that works.
The spreadsheet is updated daily, so I need something that would continue to work as more and more data is added to the column.
Try:
=round(AVERAGE(OFFSET(H1,MAX(ARRAYFORMULA(ROW(H:H)*--(H:H<>"")))-7,,7)))
here's working sample
Explanation
We are getting the last non empty row: MAX(ARRAYFORMULA(ROW(H:H)*--(H:H<>"")))
Then with offset formula we are getting the range of last 7 cells in a column.
And then just use AVERAGE.
More info
You may find more info about finding the last non empty row here:
Selecting the last value of a column
Another way is to use INDEX and MATCH. The first match finds the position of the last number in the range and takes 6 away from it: the second match finds the position of the last number in the range. Passing it through the INDEX function gives a reference that you can use to give a range of 7 cells for AVERAGE to work on.
=average(index(H:H,match(999,H:H)-6):index(H:H,match(999,H:H)))
So my answer is like your Link2
The big snag here is if you have a text cell in the range (like "Nothing") it is much more difficult to work out which cell to start from to get an average of 7 cells. I think I know how to do it in Excel using OFFSET but offset doesn't seem to work in the same way in Google Sheets.
However I can see there is a solution to this in your Link3 which should work for you if you change A:A to H:H and SUM to AVERAGE. I have tested it on the average of the last ten cells which includes a "Nothing" cell:
=ArrayFormula(AVERAGE(QUERY(SORT(H:H,ROW(H:H)*ISNUMBER(H:H),0),"select * limit 10")))
and it gives the correct answer 61.8.
The way array formulas work in general is that instead of passing a single value to a function you pass a whole range or array (a list of values) and the function processes them one by one. The above formula takes the whole column H:H and sorts it on the row numbers in descending order but those cells which don't contain a number give zero in the multiplication and are sorted to the bottom. Then the query takes the top (in my case) 10 cells and passes them to AVERAGE.
BTW this doesn't have to be declared as an array formula: this also works
=AVERAGE(QUERY(SORT(H:H,ROW(H:H)*ISNUMBER(H:H),0),"select * limit 10"))

Resources