Google Sheet Sum Row: Count if above or below criteria - google-sheets

I am trying to create a summary row in a google sheet that tallies up how many cells met their criteria. These criterion are set in 2 columns to the left; Column C is the "Goal" column, which has the goal number. Column D is the "MinMax" column, which determines if that goal number is the min or max.
For example, if the Goal is 5 and the MinMax is Max, then the goal is 5 or less (5 being the maximum number allowed).
I already have successfully created conditional formatting for this sheet, which looks like the following:
=IF($D4="Min",E4>=$C4,E4<=$C4) | Turn cell green
I am struggling to find a way to use a similar calculation for the Summary row. I feel like I might need an array formula, but I'm not sure how to set it up.

If you want to count the values try:
=if(D2="Max",countif(E2:E,">="&C2),countif(E2:E,"<="&C2))
If you want to sum them useL
=if(D2="Max",sumif(E2:E,">="&C2),SUMIF(E2:E,"<="&C2))

I actually figured out a formula!!
=countif(ARRAYFORMULA(if($D$4:$D$19="Min",E$4:E$19>=$C$4:$C$‌​19,$C$4:$C$19>=E$4:E‌​$19)),true)-countif(‌​E4:E19,"N/A")
I had to go back into the data and change the blank cells to "N/A" to make it work, but it works!!

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

Sum two ranges separately in one formula

How can I do one single formula to sum two ranges and display them in their respective column.
Here I'm using SUM formula in each cell but I'm sure there must be a single formula that can accomplish this.
Value 1 and Value 2 are the ranges to add them together in Sum row.
Here is an example picture.
Since arrayformula does not support sum, I suppose you could also do this in C12:
=arrayformula(C10:I10+C11:I11)
Clear the formula you have in row 12 and then enter in C12
=index(mmult({1,1}, --C10:I11))
Change range to suit and see if that helps?

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

Google Sheets - Multiply field by field three to the left

My title might not be very specific, so I'm going to try to explain a little better.
The sheet is divided into a name(Column A), containing a certain number of values(Column B), that get added together to a total in Column C. Furthermore, Column D, E and F contains the values I want the Total in Column C multiplied by. These first columns A to F I just fill in manually, but I would like a function to calculate the Columns I've called x, y and z total (G, H and I).
I see a pattern in this, I just can't figure out the syntax to get Sheets to see it aswell.
The pattern I'm invisioning is for each row, I want column G, H and I to take the value 3 fields to their left, and multiply it by Column C, at their row number.
Is this somehow achievable? I tried finding a solution online but I guess I don't know how to word myself.
Here's a picture to maybe make everything a little clearer
This would save me alot of time, given that I have over a hundred different rows this calculation needs to be performed on...
If something is not clear, please feel free to write a comment. I'll be following this thread quite liberally.
Thanks in advance!
You can have this formula on the first xTotal:
cell G2: =ARRAYFORMULA(if(len(C2:C),C2:C*D2:D,))
cell G2: =ARRAYFORMULA(if(len(C2:C),C2:C*E2:E,))
cell G2: =ARRAYFORMULA(if(len(C2:C),C2:C*F2:F,))
I created a sheet with the same results you had before, but this time you don't need vertical columns, just say in the # of Values column how many numbers you should have below. You just need to input the values with the grey columns.
Note: This is assuming you will always have growing vertical numbers like 1,2,3,4,5. In the new sheet you just need to set 5 in the column and it will calculate the result.
Please make a copy of this sheet and edit as you wish.
Sheet
You can use a single, simpler formula for this in cell G2
=ARRAYFORMULA(if(C2:C="",,C2:C*{D2:D,E2:E,F2:F}))

Conditional formatting for multiple blank cells and running total in Google Sheets

I'm trying to track voting attendance for meetings and I'm having varying degrees of successes.
Problem Scenario:
Column H, I, and J contain either a 1 or a blank and represent if they attended one of the last 3 meetings.
For all rows if ALL 3 Columns (H, I, AND J) are BLANK or "", mark that entire ROW RED
Then I need to SUM the number of rows that are marked RED and subtract that from voting members.
I've tried leveraging Conditional Formatting tool > Custom Formula with not much success. Below are some of the things I tried and failed even on the first part of my scenario.
=IF(SUM(H4:J4)>0,false,true)
=ISBLANK(H4:J4)
=IF(ISBLANK(H4:J4),false,true)
=ARRAYFORMULA(OR(ISBLANK(H4:J4))) = FALSE
None of these quite worked as hoped and even copying to each row and pasting conditional formatting also messed up the formula further.
For formatting: Use the Conditional Formatting using the COUNTBLANK(range) formula.
Go to Conditional Formatting
Select the range you want formatted (in your case H1:J50 assuming 50 rows)
Select Custom Format is
Add the expression =countblank($H1:$J1)=3
Select red from the color palette
Press Done
Then your blank rows will now be highlighted red.
To Count the Blank rows:
Choose an used column.
Enter the expression =if(countblank($H1:$J1)=3,1,0) in Row1 and auto fill as many rows as needed.
Total at bottom and use this value for you subtraction.
There may be easier ways but =if(countblank($H1:$J1)=3,1,0) will put a 1 in the row if H1:J1 are all blank.

Resources