Replace 0's with FALSE and 1's with TRUE - google-sheets

I'm using a COUNTIF formula to find matches between two ranges. Of course, COUNTIF returns a numerical value, but I need TRUE or FALSE values. So I added NOT() to the formula, which gave me TRUE/FALSE, but in my case, the results were backward, so I added an additional NOT() to reverse the results and this works fine for my purposes.
My question is: is there a better way to do this? Obviously, this isn't a lot of characters to type (I've put more effort into typing this question...), but if there is a simpler, cleaner solution, I'd like to know.
Here is my full formula:
=NOT(NOT(COUNTIF(projectSelections!B2:B&projectSelections!C2:C,itemsAssociations!A3:A&itemsAssociations!B3:B)))

=ARRAYFORMULA(A1:A10=B1:B10)
=ARRAYFORMULA(REGEXMATCH(A1:A10, "^"&B1:B10&"$"))
=ARRAYFORMULA(IF(A1:A10=B1:B10, TRUE))
=ARRAYFORMULA(NE(A1:A10, B1:B10))
=ARRAYFORMULA(REGEXMATCH(""&A1:A10, "^"&B1:B10&"$"))

I don't know specifically about google sheets, but in general a double negation is not an unusual technique to convert a numeric value to a boolean.
Alternatively, there is also the possibility to check if the value is not equal to zero, which in the case of google sheets can apparently be done with the NE() function: NE(COUNTIF(...) ,0). As explained in the documentation, NE(a,b) is equivalent to a <> b.

You're overthinking. To get TRUE and FALSE just use
=COUNTIF(...)=0

Nothing wrong with what you did. Another option is to use Perl or Python to clean up the data file. You could export in CSV format or clean up before going into google docs.

Related

How to use Lambda so the if statement is it's own test condition without rewriting if statement in google sheets

This is a general question based not on specific formula - but I couldn't find an answer to it anywhere - but it seems like it should be possible.
In this screenshot, you, Y and X are the same for the sake of example (there is a slight difference, but for example's sake - let's assume it's the same).
In the formula, the same formula is used in an if statement to determine if we should move forward with actually calculating the formula. Is there a way to use lambda not to repeat the formula?
yes you may condense it to something in the sorts of:
=lambda(X,if(X>0,X,0))(*FORMULA*)
a generalized example in the screenshot:

Split Function with Index Match function

I have a column that has multiple comma separated values, I need to use Split function and then run index match on that column, is it possible ? if yes somebody can help pls
Yes, you can do this, I just tested it in google sheets.
=INDEX(<array>,MATCH(SPLIT(<cell>,","),<array>,0))
To be honest, I was googling for something similar and ran across this issue. My problem turned out to be that I was using ',' and NOT ",". I suspect you asked this question for similar reasons (you tried it and it didn't work). So just to confirm, it is totally possible, the issue is likely an error with your formula.
output of a minimal example, using the above formula, matching on the first split:

Append check function with _Strict?

An answer in this question mentioned you can use ISDATE_STRICT in an array formula, and it worked.
I searched all over and could not find a reference to the use of _STRICT anywhere.
Does this apply to all "IS" check functions?
What exactly is it doing?
Yes, unfortunately, I also don't see any articles/documentations about this one except this.
The link above is a list of sheets formulas, we can see _STRICT on 3 formulas.
ISDATE_STRICT, ISDATETIME_STRICT, ISTIME_STRICT
The link above does answer your first question, it does not apply to all functions IS functions.
Based on their behaviors, I guess that they strictly check if the value is treated and valid as date/time/datetime in sheets itself. Simply passing string as parameter will yield FALSE.
Testing:
Note:
I have a hunch why 25:02:00 for ISTIME_STRICT is still valid for time even though it goes past 24. Sheets automatically converted that value from the inputted value 25:02 thus suggests that what sheets treats as date/time/datetime, will always yield TRUE for those functions.
To test the hypothesis above, I inputted November 31, 2021 1:00 manually and it wasn't converted into 11/31/2021 01:00:00 automatically, it was still the same cell value because it wasn't treated as datetime variable by sheets, thus returning FALSE

Filter and logical operators

EZ stuff but after an hour.. =filter(May15!A:S , May15!E:E="Authorization") is yielding a rich populated sheet. However I can't get OR working! Despite it working elsewhere in the sheet. I'd like other possibilities via the same filter. I tried several including the OR this way
=filter(May15!A:S , OR(May15!E:E="Authorization" , May15!E:E="bigwhale", May15!E:E="hi"))
.. to no avail. Any help appreciated. Also, I read somewhere the OR could be accessed using a "+" and that sounded like a neat method.. Thanks!
One possible way is to use RegEx:
=filter(H:H , REGEXMATCH(E:E,JOIN("|",A1:A3)))
put in A1:A3:
Authorization
bigwhale
hi
This trick is useful when you need to add conditions, just paste one more value in cell A4 and use range A1:A4
Another way is to use plus sign:
=FILTER(H:H,(E:E="Authorization")+(E:E="bigwhale")+(E:E="hi"))

How can I use the OFFSET() formula with a range of values?

EDIT: Disclaimer about the XY problem: The actual, concrete problem I'm trying to solve is: How can I make "recursive" (is that the right term here?) formulas that use infinite ranges in Google Spreadsheets/Excel? The solution I'm working with involves the OFFSET() formula. I'm asking this question because I'd like to get an extensible understanding of the way formulas use and implement ranges, especially infinite ranges.
I'm working in Google Spreadsheets and trying to create ArrayFormulas that will automatically expand without needing to use the fill handle as new data is added in the requisite columns.
To do this, I want to use infinite ranges such as A2:A when I do calculations so that no matter how much data is added, I'll never have to drag-fill any data or formulas and I can just let the spreadsheet iterate and do the work.
I'm running into a problem, though, when I try to use these infinite ranges with the OFFSET() formula. What I'm trying to do is have each cell in the range pull values from a couple of the cells next to it (thus the offset), do a simple calculation with those values, and make that the new cell value. But because the formula interprets the instruction as attempting to offset an entire (infinite) range of values, it returns a #REF! error. Here's a shared example sheet that demonstrates what I'm trying to do.
https://docs.google.com/spreadsheets/d/1V3ldSBoCrzyVWcn66wFBkDOmxt6iuYgtiU_H4KQ6J14/
If for some reason you can't see the formulas, the formulas I'm using are:
C3 =ArrayFormula(Offset(C3:C, 0, -1) - Offset(C3:C, -1, -1))
F4 =Arrayformula(Offset(F3:F, 0, -1) + Offset(F3:F, -1, 0))
Both of these return a #REF! error. C3's alt-text reads: "Error: Result was not automatically expanded, please insert more rows (1)." F3's alt-text reads: "Error: Circular dependency detected."
I'm decently confident why these don't work - you're apparently not allowed to use and refer to ranges this way. I don't, however, know how to fix this.
The two use-cases in the spreadsheet are essentially the same thing, backwards. Chances are if I can figure out one I can reverse-engineer it to work for the other one, but I've had no luck so far.
I've Googled around a lot and while I've never found anything that solves this problem, a lot of similar problems seem to be solved by using the INDIRECT() function. I can't understand how this would apply here, though, that function seems to be strictly for parsing values dynamically from cells with variable input.
(I should probably mention that this data is on a back end sheet and it's getting pulled on another sheet to display some charts on the front end. I wouldn't ask a question here if this data was the only thing involved.)
Any help or a step in the right direction would be appreciated.
If I'm understanding your question, one way to make an offset function expand automatically is to attach a count function, eg. in excel
=offset(C2,,,counta(C:C))
However, this will give you a circular reference error. To address this issue, this is one solution that I have used:
"OFFSET(C3,,,MATCH(9.99999999999999E+307,OFFSET(C3,,,ROWS(C:C)-ROW(C3))))"
This function passes an array based on the last number cell in the column. And for it to be used properly, it needs to be wrapped in a function that can handle arrays, like SUM().

Resources