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
Related
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)
I'm still new to Google Sheets and still learning, so in my GS I tried using AND and OR formula to produce the results like: -
A | B
-----
1 | 1 TRUE
1 | 2 TRUE
2 | 1 TRUE
2 | 2 FALSE
3 | 1 FALSE
3 | 2 FALSE
But this is the closest I get. What is the best formula that will help me produce result like I shown above.
Your rule is not entirely clear. For instance, could there be zero values? Negative values? But since you have not included such examples in your sample set, the following formula will produce the desired result according to the only data you've included.
Assuming you have headers in A1 and B1 and that your numeric data runs A2:B, delete everything from Col C (including any header) and place the following formula in C1:
=ArrayFormula({"Header";IF(A2:A="",,A2:A+B2:B<=3)})
This one formula will produce all results for all rows (again, judging by the very small data set and implied rule for such in our post).
You can change Header to any header text you like.
The rest reads this way: "If any cell in A2:A is empty, return null in the corresponding cell of that row in Col C. Otherwise, assess whether the combined total of the numbers in Col A and Col B is less than or equal to 3 and return TRUE or FALSE accordingly."
I would like use the QUERY function / Google Query Language in Google Sheets to count multiple columns based on conditions for each of these columns and grouped by date.
This is how the database looks (it is a list of emails sent out with a timestamp and info about if they were opened and clicked on):
date
opened
clicked
2021-09-14 4:30:06
TRUE
FALSE
2021-09-14 4:30:10
TRUE
TRUE
2021-09-15 4:30:10
FALSE
FALSE
2021-09-15 4:30:11
TRUE
TRUE
2021-09-15 4:30:18
FALSE
FALSE
This is the outcome that I need (I basically want to know how many emails per day were opened and clicked on):
date
count opened
count clicked
2021-09-14
2
1
2021-09-15
1
1
I know that I can achieve this for one column using the following query:
select
toDate(A),
count(B) where B=TRUE
group by toDate(A)
but if I try to apply the query to two columns it does not work:
select
toDate(K),
count(B) where B=TRUE,
count(C) where C=TRUE
group by toDate(K)
Is there elegant way to achieve this using a single formula?
You can convert the data in the query input into the type you want - in this case just remove all FALSE values from the table
=(query(ARRAYFORMULA({A:A,SUBSTITUTE(B:C,"FALSE","")}), "select toDate(Col1),count(Col2),count(Col3) where Col1 is not null group by toDate(Col1)"))
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))
I have a sheet where I want to see if a column contains a certain String. If this is the case TRUE shall be returned, FALSE otherwise.
Here is what I tried, resulting in #VALUE!:
IF(SEARCH(A2, 'Dashboard Table'!A16:A), TRUE, FALSE)
What to do?
Thanks
Florian
The formula returns #VALUE! because IF requires a boolean value (0 is considered as FALSE, 1 or greater numbers are considered as TRUE) as the first argument, but SEARCH returns #N/A! if the text to search is not found, by the other hand SEARCH looks for the text on a cell value.
The following formula will return a array of TRUE/FALSE values, TRUE when the value of A2 is found, FALSE when not on cells A16:A:
=ARRAYFORMULA(IF(IFERROR(SEARCH(A2, 'Dashboard Table'!A16:A),FALSE), TRUE, FALSE))
To get a single TRUE when the text to searh is found on any cell on A16:A use
=ARRAYFORMULA(sum(IF(IFERROR(SEARCH(A2, 'Dashboard Table'!A16:A),0), 1, 0))>0)