Test cell value if is in the interval with arrayformula - google-sheets

I want to use arrayformula on the top of my row to spam its calculations in the column. In my sheet I have to test if the value on the cell of column F (Teste) is on the interval (for instance if cell F18 = 2 < 3 is TRUE). Here's the code on the cell G1 I've written:
=ARRAYFORMULA(IF(ROW(G:G)=1;"Classe";IF(AND(F2:F>0;F2:F<3);"ok";1)))
But instead of computing the AND(F2:F>0;F2:F<3) it just returns FALSE. So the question is: how do I write such formula that takes a value on a cell and compares if it is on the interval I want and then show "ok"? Thank you for the help!
Image of my sheet:
My spreadsheet image

use:
=ARRAYFORMULA(IF(ROW(G:G)=1; "Classe"; IF((F2:F>0)*(F2:F<3); "ok"; 1)))

Related

SUMIF function adding up time with criteria in another cell (date)

Say I have to sum up the cells in column I if their corresponding cells in column B >= the value in specific cell, E5.
I've tried SUMIF(I9:I12,"<="&E5,B9:B12) and it didn't work. Actually the result is 4307280:00.
Column B is formated to dd-mmm.
E5 cell is formated to dd-mmm.
Column I is formated to [hh]:mm.
result cell is formated to [hh]:mm.
How do you fix it so that the criteria of the SUMIF function involves the value in a specific cell? I'd like to set it this way because I have to add up the hours up to and including a specific date.
Thank You

GOOGLE SHEETS: Help needed to sum a range of cells across rows, where the range is controlled by a variable

I need to sum a range of cells across rows, but I need to be able to specify the amount with a variable.
For example.
If i write 5 in cell B1, I want to sum range A1:A5.
If i write 10 in cell B1, I want to sum range A1:A10.
If i write 20 in cell B1, I want to sum range A1:A20.
And so on.
Does anyone know a formula for this?
Kind regards.
I tried writing( in cell B1) =SUM(A1:A(1+B1)). This didn't work at all, instead a =NAME? appeared.
You may use INDIRECT to set a range by joining text, like this:
=SUM(INDIRECT("A1:A"&B1))
This formula will also work:
=SUM(BYROW(SEQUENCE(B1),LAMBDA(ROW,INDEX(A1:A,ROW))))
SEQUENCE() return an array of rows count up from 1 by default.
BYROW() can use an array as row reference and apply a LAMBDA() function to each row.
INDEX() return the CELL the matches a given INDEX of ROW and COL.
SUM sum up every value of a range (array).
also possibility:
=SUM(A1:INDEX(A:A; B1))
or:
=SUMPRODUCT(A1:INDEX(A:A; B1))

Google Sheets keep max value constant

Refer the sheet in the figure
For the H column, I want Hj = Gj+MAX(F)-Fj , where j = row number.
The given formula works for the second row, but when I drag to other rows, MAX value also changes. I want MAX(F2:F8) to be constant and other values to change. How can I do that?
Fix the max range like this F$2:F$8 ($ fixes the range).
Instead of dragging the formula down from cell H2, you could use an arrayformula in cell H2:
=arrayformula(if(F2:F<>"",G2:G+max(F:F)-F2:F,))
F2:F<>"" evaluates the calc whilst each cell in column F is not empty, otherwise the , at the end of the formula does nothing.

Fill column with maximum/last value from another column

How can I get the result as in example with ARRAYFORMULA up to last filled cell A?
I can do it with formula in cell C1 =MAX(B$1:B1) but in that case have to copy the formula in each cell in turn.
In C2 try:
=ArrayFormula(if(row(A2:A) <= max(if(not(isblank(A2:A)), row(A2:A))),vlookup(row(A2:A),filter({row(A2:A),B2:B},len(B2:B)),2),))
See this spreadsheet for an example.

Conditionally color Google Spreadsheet cell if value matches different column in same row

I have a Google Spreadsheet with data values in the first 10 columns (A through J) and the 11th column (K) has a reference value. This pattern repeats for 150 rows
So, for the first row, A1 through J1 are the data values and K1 is the reference value.
And for the 25th row, A25 through J25 are the data values and K25 is the reference value.
Now, for any data cell (cells within the first ten columns), where the value in the cell matches the value in the corresponding reference cell (at column K in the same row as the data cell), I want to change the background color of the data cell.
So, for data cell A1: if value in A1 == value in K1, change background color of A1
And, for data cell C23: if value in C23 == value in K23, change background color of C23
I assume that conditional formatting should be able to do this, but I could not figure out how. I know how to do conditional formatting for a single cell, but I can't figure out how to apply conditional formatting to the entire table (cells A1 through J150) at once.
Use the following custom formula in conditional formatting:
=A1=$K1
and apply to range A:J.
To exclude blank cells (and cells with zero-length text strings), try:
=AND(LEN(A1),A1=$K1)

Resources