Sheets ArrayFormula to target multiple rows - google-sheets

In my one we are checking that the numbers in this row are between one and two.
I am supposed to populate ONE column based on the numbers on the corresponding row in columns A,B,C,D .
However my formula is doing the checks on on individual cells and pasting the result in multiple columns.
My formula:
=ARRAYFORMULA(IF(ISBETWEEN('Sheet 2'!A2:D99,1,2),"Small", "FALSE"))
Output with my formula
FALSE Small FALSE Small Small
Small Small Small FALSE Small
Small Small Small FALSE Small
FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE
My formula is reading
5 2 3 1
2 2 2 2
2 2 2 1
Output I wanted
FALSE
TRUE
TRUE
Can someone please help me to achieve my output thanks!

Use this formula
=IF(COUNTIF(ISBETWEEN(A2:D2,1,2),TRUE)=COUNTA(A2:D2),TRUE,FALSE)

Related

Google sheets - Count duplicate text in a column with conditions

I have an spreadsheet like this:
product name
sold?
banana
FALSE
banana
TRUE
apple
TRUE
apple
FALSE
apple
FALSE
I'd like to add another column to display the number of unsold products. so the desired result would be something like this:
product name
sold?
available
banana
FALSE
1
banana
TRUE
1
apple
TRUE
2
apple
FALSE
2
apple
FALSE
2
Thanks.
You need COUNTIFS(). Try-
=COUNTIFS($A$2:$A,A2,$B$2:$B,FALSE)
For dynamic spill result, use MAP() function.
=MAP(A2:A6,LAMBDA(x,COUNTIFS(A:A,x,B:B,FALSE)))
To refer full column as input, use-
=MAP(TOCOL(A2:A,1),LAMBDA(x,COUNTIFS(A:A,x,B:B,FALSE)))

Partition timeseries with state using Dask Dataframe based on custom condition

I have a large number of parquet files in s3 which together represent a large timeseries describing an evolution of a certain state
delta timestamp
0 True 1
1 False 2
2 False 2
3 True 3
4 True 4
5 True 5
6 True 6
7 False 7
8 False 7
9 False 7
10 True 8
11 True 9
Rows grouped by same timestamp with delta==False represent a full state of a system at given timestamp (note same timestamp values), while delta==True represent a partial change of the previous state.
My goal is to apply a row wise operation to this timeseries which restores state, updates it on each change and performs certain calculation, producing a new timeseries (or an aggregate value, this is not relevant at this point). All of this should be performed in parallel on a multi-machine cluster with Dask.
For this, I want to create a partitioned Dask Dataframe which makes sure that each partition starts with a block of rows with delta == False e.g. each partition knows full state at the beginning and apply my function to this partition.
Partition 1 (note row 0 is discarded since no previous `delta==False` values are found)
1 False 2
2 False 2
3 True 3
4 True 4
5 True 5
6 True 6
Partition 2
7 False 7
8 False 7
9 False 7
10 True 8
11 True 9
In original data timestamps are already sorted (though minor misordering may occur)
My questions are:
Does this sound like a correct approach? If so, how do I perform such a partition? Going through docs, I found set_index, which in my case doesn't help, and a map_overlap function which also doesn't fit since it uses fixed threshold for each partition, which I don't know beforehand.
What would happen if I have a long range of rows with delta==True? I will need to somehow partition it as well, while keeping reference to previous partition until I reach a partition which contains full state, i.e. records with delta==False. I guess this should be handled by a task graph, but is there a way tell Dask to wait for a certain partition to be processed?
Thanks!

Conditional formatting based on pairs of cells on different sheets

I'm attempting to apply conditional formatting if any two "paired" cells in two different ranges are both true.
The first range is on Sheet1, where the conditional formatting occurs. The second range is on Sheet2. However, the "pairing" is many to one, where the cells in a single Sheet1 column all map to one cell in Sheet2.
For example:
Sheet1
A (conditionally formatted column)
B
C
D
E
1
Value1 (formatting applies)
True
True
True
True
2
Value2
False
False
False
False
3
Value3
False
True
False
True
4
Value4 (formatting applies)
True
False
False
False
5
Value5 (formatting applies)
False
True
True
False
Sheet2
G
H
I
J
1
True
False
True
False
I'm currently using the following custom formula, and setting the conditional formatting range to A:A on Sheet1.
=OR(AND(B1, INDIRECT("Sheet2!G1")), AND(C1, INDIRECT("Sheet2!H1")), AND(D1, INDIRECT("Sheet2!I1")), AND(E1, INDIRECT("Sheet2!J1")))
The formula works for this example, but in reality I have 35 columns (and more to come). I'm looking for a more sustainable solution. Is there a way to use ranges in my example custom formula, instead of a series of AND conditions?
How about
=ArrayFormula(sum(B1:E1*indirect("sheet2!g1:j1")))
Or shorter
=SUMPRODUCT(B1:E1*indirect("sheet2!g1:j1"))
try:
=(((B1=INDIRECT("Sheet2!G1"))+(C1=INDIRECT("Sheet2!H1"))+(D1=INDIRECT("Sheet2!I1"))+(E1=INDIRECT("Sheet2!J1")))>1)*(A1<>"")
demo

How to create a Google Sheets AND formula that returns an array of TRUEs and FALSEs instead of a singular TRUE or FALSE? [duplicate]

This question already exists:
Why does the AND() condition/function doesn't work with ArrayFomula [duplicate]
Closed 4 months ago.
So here's what I have been trying to do.
I have written Formula 1 in cell A1:
=ARRAYFORMULA(Data!A1:A7="Angie")
And Formula 2 in cell B1:
=ARRAYFORMULA(Data!B1:B7<1000)
These two formulas return the following output:
A
B
C
1
TRUE
TRUE
TRUE
2
FALSE
FALSE
FALSE
3
FALSE
TRUE
FALSE
4
TRUE
FALSE
FALSE
5
FALSE
FALSE
FALSE
6
FALSE
FALSE
FALSE
7
TRUE
TRUE
TRUE
I am trying to combine these two formulas into one using the AND function in Cell C1 (column C is the expected output), but I'm having difficulty doing so.
Here is what I attempted:
=ARRAYFORMULA(AND(Data!A1:A7="Angie",Data!B1:B7<1000))
and also this:
=AND(ARRAYFORMULA(Data!A1:A7="Angie",Data!B1:B7<1000))
Both of them return a single FALSE value in cell C1 as opposed to an array output like the ones in columns A and B. I need an array output as I would be using it in conjunction with another formula. I am sure I must be missing something very important, and having difficulty zeroing in on it. Could you please help me?
AND is not supported under AF. use:
=ARRAYFORMULA((Data!A1:A7="Angie")*(Data!B1:B7<1000))

Crystal Reports: Display only the value I want

I am working on a report that I am trying to display the value that I only want to show. Based on a formula, the report displays the value if the criteria is true, else zero. The report currently shows:
01(group number)
True 170
False 0
False 0
02
False 0
False 0
True 185
What I want is to move the "true" number next to the group number on the report. So it will show:
01(group number) 170
02 185
The field does not show up in the summary option because the formula contains the sum function.

Resources