Using Google sheets arrays like in Microsoft Excel (ANDING two arrays) - arrays

Hello I would like to combine two arrays in google in such a way:
={TRUE,TRUE,FALSE}*{FALSE,TRUE,FALSE}
Where the result should equal: {FALSE,TRUE,FALSE}
In excel that formula listed above works. In google I simply get 0 as the result. What should I enter in google to get the result like I do in excel?
Example in excel I am trying to achieve Excel
Example in Google Sheets: Google Sheets
Tried:
={TRUE,TRUE,FALSE}*{FALSE,TRUE,FALSE}
Expected:
{FALSE,TRUE,FALSE}

use:
=INDEX({TRUE,TRUE,FALSE}*{FALSE,TRUE,FALSE})
and if you want a boolean back do:
=INDEX(TRUE=({TRUE,TRUE,FALSE}*{FALSE,TRUE,FALSE}))

Have you tried simply using ARRAYFORMULA? For example,
=ARRAYFORMULA({TRUE,TRUE,FALSE}*{FALSE,TRUE,FALSE})
Or, if you insist on an array of Booleans:
=ARRAYFORMULA({TRUE,TRUE,FALSE}*{FALSE,TRUE,FALSE}=1)

Related

Choose function return 2 columns on Google Sheets

Is there any way to return the two columns in the choose function
For example, here in excel (image), I can do it with:
=CHOOSE({1\2};B1:B10;A1:A10)
formula in excel
Is there a way to do this in google sheets? Or some similar formula?
try:
={C1:C11\ A1:A11}
or if your sheet is english:
={C1:C11, A1:A11}
update:
={F1:F12, A1:E12}

How do I get value of an indirect formula into a format that can go into an array?

My Google Sheet that will be updated over time with new sheets. On my dashboard/master sheet, I can write a simple INDIRECT that will pull information from a cell in the sheets. However, the formula does not replicate its way down the column. I understand that I need to use an ARRAYFORMULA to get the auto formula placement done.
I've tried many ways but the one that I think may get me there is to use CONCAT. My columns look like this:
Event Title [uses a script to pull in the names of all the sheets]
Use an array to get the titles so they pre-poluate down the column so I can use it later: =ARRAYFORMULA(IF(Row(A:A)=1,"Get Title from A",IF(ISBLANK(A:A),"",A:A)))
-- The Event Title is now appearing as plain text in Column B.
I then use CONCAT to write the part of the formula I need to help get the name of the INDIRECT in without using the INDIRECT formula.
=CONCAT("'"&B5&"'"&CHAR(38)&"!"&"""","B2"&"""")
-- This gets me this result: 'Computers 101'&"B2"
At this point, my hope is that I could then use this information ('Computers 101'&"B2") into an ARRAYFORMULA. I used this formula to try and do that:
={"Event Date";ARRAYFORMULA(A6:A+D6:D&"Cat")}
-- I get the answer: 0
The expected value was the date cell (B2) in the Computers 101 sheet. Any ideas how to proceed? I don't know the names of the sheets in advance.
unfortunately, this is not possible within of scope of google sheets formula. if you need ranges from other than the actual sheet you need to use INDIRECT which is not supported under ARRAYFORMULA.
you have 3 options:
hardcode it like: https://stackoverflow.com/a/68446758/5632629 with IFERROR & array of empty cells to match columns of your range
generate formula which will generate your final formula/range as a text string and then use a simple script to convert that string into the valid formula: https://stackoverflow.com/a/61819704/5632629
do it all with scripts

Concatenate or join of dynamic array when importing multiple ranges

I have a set of hyperlinks to other sheets that will change as new links are added or subtracted. I am looking to write a function that will import the same range from all of these sheets. The sheets are all based on the same template.
I am able to create the dynamic range using the following:
C1 ="B1:B"&counta(B1:B)
I then join everything with this formula here:
="{importrange("&join(", """&"Sheet1!A:A"&"""); importrange(",indirect(C1))&", """&"Sheet1!A:A"&""")}"
The output shows what I need the formula to be, however it will not calculate and appears as a string. I tried using indirect on the formula created, however this does not work either as it states indirect requires a valid range.
{importrange(https://docs.google.com/spreadsheets/d/19S08r/, "Sheet1!A:A"); importrange(https://docs.google.com/spreadsheets/d/19S08r/, "Sheet1!A:A"); importrange(https://docs.google.com/spreadsheets/d/1uxdty/, "Sheet1!A:A"); importrange(https://docs.google.com/spreadsheets/d/19S08r/, "Sheet1!A:A")}
Google Sheets built-in functions can't convert a TEXT value into formula. This could be done only by using Google Apps Script or the Google Sheets API.
The method to be used is setFormula / setFormulaR1C1 to return a single formula, and setFormulas / setFormulaR1C1 to return an array of formulas.
NOTE: IMPORTRANGE requires that the first parameter be a TEXT value, so if you will include the URL directly instead of using a cell reference, the URL should be quote enclosed.

Is it possible to change countif to an array google sheets

Below are two formulas that I use to determine if courses selected are full or if there is a vacancy. I am wondering if it is possible to change these formulas to an array or if there is a workaround that would accomplish the same result.
=if(COUNTIF(G$2:G2,G2)<=(VLOOKUP(G2,$AC$2:$AD$50,2,0)),G2,"Full")
=if(W2="Full",if(COUNTIF({R$2:R;S$2:S;T$2:T;U$2:U;V$2:V;W$2:W},M2)
Edit: link to demo sheet https://docs.google.com/spreadsheets/d/1nPhrEKhKwuq3YSghgJ4LFoHZqOzo67_b1qohh1NABJo/edit?usp=sharing
I duplicated the sheet and entered in R2
=Arrayformula(IF(LEN(G2:G), if(COUNTIF(G$2:G,G2:G)<=(VLOOKUP(G2:G,$AC$2:$AD$50,2,0)),G2:G,"Full"),))
and in S2
=ArrayFormula(if(len(R2:R), if(R2:R="Full",if(COUNTIF(R$2:R,H2:H)<VLOOKUP(H2:H,$AC$2:$AD$50,2,0),H2:H,"Full"),),))
See if that works for you?

Google Sheets ARRAYFORMULA() different results from Excel{}?

I'm getting some odd results when using an ARRAYFORMULA() function in Google Sheets. Comparing the same formula in Excel, I get a correct answer in Excel and an incorrect answer in Google Sheets.
Here is a shared Google Sheet with the error and a screenshot of the result from Excel
The result should be 12, meaning that there are 12 months where Bob works in at least one location.
Any ideas would be much appreciated! TIA!
Google sheets has a lot of different functions. Use this instead:
=count(UNIQUE(filter(A2:A22,B2:B22=E4)))

Resources