Increment row, not column of spreadsheet - google-sheets

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.

Related

How to Count cells since the last filled cell in a column, and repeat for each time a cell is filled

I have a tracking spreadsheet to track dry streak calcs for certain drops from a boss in a video game. I want to be able to easily see my dry streaks by having the sheet count the amount if boss kills since the last drop.
I have the following:
=IF(B2="",COUNTBLANK(B2:INDEX($B2:B,MATCH(FALSE,($B2:B=""),0))),"")+1
where column A is the boss kill count, and column B is filled if a drop is received.
the above formula works to an extent of what i want, but the order is upside down. I'd also like it to only show the "count since last drop" when a cell in column B is filled., rather than every cell showing it.
Example sheet
If column A is a sequence of numbers as depicted in the sample you can use formula 1 and formula 2 is stand-alone just based on column B. Please test them out.
formula 1:
=let(a,filter(A2:A,B2:B="drop"),byrow(A2:A,lambda(z,IF(offset(z,,1)="drop",z-xlookup(offset(z,-1,),a,a,,-1),))))
formula 2:
=let(a,filter(row(B:B)-1,B:B="drop"),byrow(B2:B,lambda(z,IF(z="drop",row(z)-1-xlookup(row(offset(z,-2,)),a,a,,-1),))))
Here you have another option that instead of looking for values it just makes a cumulative count.
=SCAN(0,B1:INDEX(B:B,ROWS(B:B)-1),LAMBDA(a,v,IF(v="drop",1,a+1)))
B1:INDEX(B:B,ROWS(B:B)-1) is a replacement for OFFSET so it is a bit more economic in resources
Then you can just hide the values when B is empty:
=INDEX(IF(B2:B="","",SCAN(0,B1:INDEX(B:B,ROWS(B:B)-1),LAMBDA(a,v,IF(v="drop",1,a+1)))))

Find a way to increment formula in merged cells and blank cells

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

Array formula for countifs to propagate down the rows (only for rows with data in column A)

I am new to google app sheet formulas.
In the image attached i have highlighted the formula, it works.
The formula i am using is =COUNTIFS(D4:S4,"y",D3:S3,"Personal")
Now i want to propagate this using ARRAYFORMULA for rows 5 and 6.
I tried with the below formula
=ArrayFormula(if(len(A2:A),COUNTIFS(D4:S,"y",D3:S3,"Personal"))
--Update
After adding the formula provided by Matt i am getting count mismatch for one row
--Update #2
As suggested by Eric, i found a space in the Header row
Unfortunately, it's not quite that straightforward to populate a COUNTIFS that reads sideways like that in the down direction. The common way to do this is with a function called MMULT() which does "matrix multiplication" but is very good for adding or counting across a 2d range like that. In your case because it's dates going sideways, i'm going to assume that the sheet keeps growing to the right? All the way across indefinitely?
You might try this in cell B4:
=ARRAYFORMULA(IF(A4:A="",,MMULT(N(OFFSET(D4,,,9^9,9^9)="Y"),TRANSPOSE(N(D3:3="Personal")))))
You can check out this MMULT() demo sheet I made a while back.

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

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