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

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)))))

## 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

### How to Transpose Rows to Columns Towards Left Columns? In Google Sheet

SECOND IMAGE CLICK NUMBER 1 I Want To Transpose Row Value Range A2:A50 To Column CZ2 To BC2. Formula Should Be Given IN CZ2. AND VALUE SHOULD GET IN REVERSE OR LEFT COLUMNS.[First IMAGE Click Number 2] 2. If I Give Transpose (AO2:AO50) In CZ2 it Will go range from CZ2 To EW2. I Want Transpose in Reverse Columns. If I Increase Row Value AO2:AO60 It Should Flow Towards Left From CZ2 To AS2. I Mean Transpose Should work towards Left Side Columns. Its Ok with any other formula If Not Transpose. Hope My Question is Understandable. Someone Help Me Out. Thank You In Advance.

It's not clear why you would want to do this. However, the end goal can be achieved by placing the following formula in cell B2 (not CZ2): =ArrayFormula(IFERROR(VLOOKUP(COLUMNS(B1:1)-COLUMN(B1:1)+ROW(A2)+1,{ROW(A2:A),A2:A},2,FALSE))) Try it and you'll see what I mean. The formula is written to be flexible. So if you add or subtract data from A2:A, the value in A2 will always be in Row 2 of the last column to the right in the sheet; and all other values will work backward from there. If you always want to start to backward progression in Column CZ and Column CZ is not (or may not always be) your rightmost column, you can use this version: =ArrayFormula(IFERROR(VLOOKUP(COLUMN(CZ1)-COLUMN(B1:CZ1)+ROW(A2)+1,{ROW(A2:A),A2:A},2,FALSE))) Just understand that, if you don't have columns at least through Column CZ, this formula will fail to work as expected. I recommend using the first formula I supplied above, since it will always work, no matter how many columns there are, filling backward as far as to the formula column (B2) as needed. Understand also that if you have more than 103 rows of data in A2:A, that would be more than could fit between B2 and CZ2; so only the first 103 would be displayed. ADDENDUM (after reading first two comments below): The principle is the same if you want to run results from "CZ to BC"; only in this case, you want to limit the results to no more than 50. Place the following formula in BC2: =ArrayFormula(IFERROR(VLOOKUP(SEQUENCE(1,50,ROW(A2)+50-1,-1),{ROW(A2:A),A2:A},2,FALSE))) To reiterate, you cannot run formulas that will fill or columns backward. (Even if the sheet is set to right-to-left font with Column A appearing at the far right, the formula is still filling A-Z according to that setup.) However, if you know that you want a 50-column range reserved and you want the answers to go backward, this can still be achieved by placing the formula in the first of the 50 columns rather than the last, as I have proposed above.

### Count number of times values increase in range - Google Sheets

how are you? I'm just not sure what to do here, but I surely can use your help! I have a series of values in a row range, such as in the following: 1000 2000 1500 2100 3200 I need to figure out a google sheets formula to put in the 6th cell of this row that counts the number of times the value of any cell is greater than the one to the left of it. In this example, my result should be 3. Is there any way that this can be done? In Excel or Google Sheets, either is great to learn. Thank you

You can also try the following formula =COUNTIF(QUERY({{"";TRANSPOSE(B2:F2)},{TRANSPOSE(B2:F2);""}}, "select Col1-Col2 offset 1 label Col1-Col2 ''",0), "<0")

Assuming you have data in A2:E, place the following in F2: =ArrayFormula(IF(A2:A="",,MMULT(IF(B2:E>A2:D,1,0),SEQUENCE(4,1,1,0)))) Since there are only four columns that might be greater than others (B:E), you can structure it this way. MMULT is hard to explain, but it essentially multiplies everything in each row of one matrix (range) by everything in another range and then adds them. SEQUENCE just forms a column of four 1's by which to multiply then add together everything in each row of the first range. Since anything times 1 is the original number, this just serves to to row-by-row addition. This formula will process as many rows as have data in A2:E.

try in 7th column on row 2: =ARRAYFORMULA(MMULT(IF(A2:E4<B2:F4, 1, 0), {1;1;1;1;1}^0))

### Counting the Number of Empty Cells between Non-Empty Cells in Google Sheets

I'm trying to count the number of empty cells that exist in a column between each non-empty cell but haven't been able to work out how. Using this, I'm also trying to find the largest "empty distances" and locate the cell in the center of these distances. The sheet I'm working with lists a set of marker colors and denotes the ones that are owned out of the full set of colors. I'm trying to find the largest ranges of missing colors and then find the colors in the middle of those ranges in order to find a handful of markers that would best help to fill out the spectrum. Columns 1-6 are information- Column 7 marks whether the color is owned:

I may have an answer that helps you. I could only get it to work using a helper column, but someone may know how to eliminate that requirement. The helper column creates an array, basically listing the row numbers of the rows that have an "x" in your column B. The main formula then measures the gap between each of these listed row numbers. It also checks the gap before the first "x", and after the last "x". Note that I have the data starting on row 2, which complicates the formula, but makes the sample sheet clearer - this can easily be changed to row 1 if you prefer. ={F2-1; query(ArrayFormula(if(isnumber(F3:F),F3:F-F2:F-1,"")), "select Col1 where Col1 > 0",0); counta(A2:A)-indirect("F"&COUNTA(F$2:F))} See a sample sheet here: https://docs.google.com/spreadsheets/d/19QUFGRqTT6BqOsBrEBpTIxQCeNdRa5mzXhxQpCZ8sV4/edit?usp=sharing Then I used a second formula to calculate the max gap between "x"s, (or before the first or after the last x). Note that calculating the midpoint of the gaps, and doing a lookup of the corresponding mid-point colour, is something that can be added to this answer, if you share a sample copy of your sheet and share it for editing. Let me know if this helps. I'll add more explanation to describe what the formula is doing tomorrow. And I'll provide a second tab with the formulas adjusted to work with data beginning on row 1.

You can also get the lengths of the gaps using Frequency: =ArrayFormula(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),if((B1:B20="X")*(A1:A20<>""),row(B1:B20)))) but finding the centres of the gaps and allowing for equal-sized gaps is more difficult. This should find the position of the "X" at the end of the longest gap: =ArrayFormula( sum(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)), if((B1:B20="X")*(A1:A20<>""),row(B1:B20)))*(sequence(countif(B1:B20,"X")+1,1)<= match(max(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)), if((B1:B20="X")*(A1:A20<>""),row(B1:B20)))),frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)), if((B1:B20="X")*(A1:A20<>""),row(B1:B20))),0)))+ countif(sequence(countif(B1:B20,"X")+1,1),"<="& match(max(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)), if((B1:B20="X")*(A1:A20<>""),row(B1:B20)))),frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)), if((B1:B20="X")*(A1:A20<>""),row(B1:B20))),0)) ) and then it should just be a case of working backwards from there to the centre of the longest gap. However the formula needs further refinement to deal with the cases (1) Where the longest gap is after the last "X" (2) Where there is a tie for the longest gap (3) Where there is a need to list the longest, second longest, third longest gap etc.

### 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.