How can I force a google sheets function like AND to perform its operation individually across each scalar index when it receives two vector inputs?
Seen below, NOT perfoms as expected with the addition of the ARRAYFORMULA function; however AND does not.
• Code
| X1 | X2 | NOT(X1) | AND(X1,X2) | ARRAYFORMULA(NOT(X1)) | ARRAYFORMULA(AND(X1,X2)) | ||
|---|---|---|---|---|---|---|---|
| 1 | 3 | =NOT(A2:A6) | =AND(A2:A6,B2:B6) | =ARRAYFORMULA(NOT(A2:A6)) | =ARRAYFORMULA(AND(A2:A6,B2:B6)) | ||
| 2 | 4 | ||||||
| 3 | 5 | ||||||
| 4 | 6 | ||||||
| 5 | 7 |
• Result
| X1 | X2 | NOT(X1) | AND(X1,X2) | ARRAYFORMULA(NOT(X1)) | ARRAYFORMULA(AND(X1,X2)) | ||
|---|---|---|---|---|---|---|---|
| 1 | 3 | FALSE | TRUE | FALSE | TRUE | ||
| 2 | 4 | FALSE | |||||
| 3 | 5 | FALSE | |||||
| 4 | 6 | FALSE | |||||
| 5 | 7 | FALSE |
>Solution :
You may try:
=map(A2:A6,B2:B6,lambda(a,b,and(a,b)))