Find a way to increment formula in merged cells and blank cells - google-sheets

It's my first time posting here, I tried to look for something similar to what i am looking for but couldn't find anything, but if I just didn't look enough, I apologize.
My problem is as follows:
https://docs.google.com/spreadsheets/d/10yx-WO_SlOnFLNW83N8wucOrcexfLtt1TE2FDzTAQbc/edit#gid=799857548
I have a data table with information I receive from somebody. I then need to use that information to feel kind of individual product data table on another sheets, and add more to it.
Instead of copy everything of sheets one in sheets 2, I would like it to feel by itself.
I tried with =Cellsadress or =OFFSET and other stuff but couldn't manage to get what I want.
When i put every formula in the green table on sheets 2 and try to increment it by dragging down, the formula values increase by 25 approximately. but i want it to increase by only one, or find another way to show the information in the column of sheets 1 to reflect in different cell of sheets 2.
In my real document i have 100 of lines, so i cant do it manually like i could do with 4 lines.
Is there a way to do that?
If somebody have a solutions i would be gratefull

try this formula for C32 =INDIRECT("'Sheets 1'!F"&(int(row()/25)+2))
when you copy-paste this formula into cell C57 or C82, it will take values from 'Sheets 1'!F4 and 'Sheets 1'!F5, respectively

Related

ARRAYFORMULA does not increase cell as it expands

I'm trying to get an ARRAYFORMULA to subtract the current cell from the previous one,
but it appears that if I write
=ARRAYFORMULA((A3:A)-(A2))
The formula does not increase of one cell as it expands.
here's an example of what I get
https://docs.google.com/spreadsheets/d/1ci4kiNCgjBZK0Ue218IRIk5t8tSmElF5EgbIxb1_Q9w/edit?usp=sharing
it's clear that it keeps referencing A2 (but I'm not using $A$2 in the formula)
if I wouldn't use ARRAYFORMULA I would simply use
=SUM(A3-A2)
Can anyone suggest me a solution?
Your sample spreadsheet is still "View only"; so neither I nor anyone else can directly leave our solutions. However, place the following formula in D1:
=ArrayFormula({"Difference"; IF(A2:A="",,IFERROR(A2:A-OFFSET(A2:A,-1,0)))})
This will create the header (which you can change within the formula itself as you like) and all results.
(Adjusting to the location in your actual spreadsheet, as indicated in your post, this would be =ArrayFormula({"Difference";IF(L7:L="",,IFERROR(L7:L-OFFSET(L7:L,-1,0)))}).)
Couple Comments
You should accept Erik Tyler's answer as he put in more work and helped you present your problem more clearly. However these formulas allow for some more flexibility if you want any values below the rows (which now that I think about it doesn't make a lot of sense based on having a dynamic array flowing down, but conceptually maybe someone will find it useful).
Simple Formula will require one cell below your range to be blank:
=iferror(filter(filter(N(A2:A),A2:A<>"")-N(A1:A),A1:A<>""),"")
Complex Formula will allow values directly below (which I again admit seems nonsensical considering the whole point of this is a dynamic expansion down rows...)
=Filter(filter(filter(N(A2:A),A2:A<>"")-N(A1:A),A1:A<>""),ISNUMBER(filter(filter(N(A2:A),A2:A<>"")-N(A1:A),A1:A<>"")))
I gave a demo on your page.

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

Google sheets filter custom formula is moved by one row

I created a column of total profit in google sheets and my goal is to filter values which are less then 70% of previous profit value (screenshot so you can understand).
But when I apply this condition to the filter custom formula (here) is not filtering the values which are less then 70% but the values before them, instead it is moved by one row (hopefully you will understand).
It may be it is something easy to fix but i really couldn't find out. Thanks for your future advice and time!
*EDIT: https://docs.google.com/spreadsheets/d/1JcHVrpOCLEdMiTF3YD0qvJiHPsi6J2QwFPN-XOfAipY/edit?usp=sharing sheet in view mode
try to shift it:
=$B2/$B1>0.7

Using the same formula for each row in sheet

I want for every row in my sheet to calculate a score using a formula. So the same formula for each row. I tried this:
=ARRAYFORMULA(min((((C3:C100)/4)+((K3:K100)*4/10)+(M3:M100)+((N3:N100)/2.5)+((O3:O100)/5)+(R3:R100)+(T3:T100)+((P3:P100)/3)+(V3:V100))/23))
But it does calculate at all, for any row. (I am starting from row 3)
Why does it act like this? Any suggestions?
It's always best to provide us a link to your sheet, so we can see what you're trying to accomplish (or at least create a copy without sensitive data and share that).
If you want the same exact formula for each row, you will get the same exact result with your current formula. Also, do you mean to SUM the range values you have provided inside the formula? If so, you need to alter your formula to look like this:
=ARRAYFORMULA(min((((sum(C3:C100)/4)+(sum(K3:K100)*4/10)+sum(M3:M100)+(sum(N3:N100)/2.5)+(sum(O3:O100)/5)+sum(R3:R100)+sum(T3:T100)+(sum(P3:P100)/3)+SUM(V3:V100))/23)))
Please be more specific about exactly what you want the formula to calculate on each row. If it's on row 20, for example, do you still want rows 3-100 to be considered? Or just rows 20-100? WHAT data do you need to be considered on each row's formula, in other words?
Here's a sheet I created to try to understand what you want:
https://docs.google.com/spreadsheets/d/1GRdU6NLMWx2xPXDNp21VzYRQRj6cjNbL4RGVUV2x8Wk/edit?usp=sharing

Increment row, not column of spreadsheet

I am working on a spreadsheet that tracks my running mileage. I've got all my miles in one column, but I want to be able to create a "Calendar View" of sorts, so I can track my miles on Mondays, Tuesdays, etc.
To do this, I am using: =Mileage!C13 for cell b2.
For cell B3, I want: =Mileage!C14.
Obviously, I will be using 7 columns for the calendar, but when I try to create a series in the row, it increases the column (instead of C14, it gives D13).
Also, I tried doing a series in the column instead, and increasing by 7 with no luck.
B2: =Mileage!C13. B3=Mileage!C20. If I select both cells and try to create a series, it gives me =Mileage!C14 instead of =Mileage!C27.
I hope this makes sense... any tips, or am I going about this completely wrong? Thanks!
You can reproduce the first 7 cells in a row fairly easily with the TRANSPOSE function:
=TRANSPOSE(Mileage!C13:C19)
However this still doesn't address the issue of being able to easily fill the formula down. Using OFFSET, we can rewrite the above formula to:
=TRANSPOSE(OFFSET(Mileage!C$13,0,0,7,1))
and then use the ROW function and a bit of maths in the second argument:
=TRANSPOSE(OFFSET(Mileage!C$13,(ROW(A1)-1)*7,0,7,1))
This formula you should now be able to fill/drag down successfully.

Resources