Array formula issue - google-sheets

I am trying to turn this into an array formula with the first cell being the header.
=IFERROR(INDEX(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1ht6brZFTrTpmh7Wr-M-59ulTRPatvAUEu0QBvqbrxhw/edit#gid=357252415", "Data!B:B"),MATCH(A2,IMPORTRANGE("https://docs.google.com/spreadsheets/d/1ht6brZFTrTpmh7Wr-M-59ulTRPatvAUEu0QBvqbrxhw/edit#gid=357252415", "Data!A:A"),0),1))
I tried formatting it like this:
=ArrayFormula({"Name";IFERROR(INDEX(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1ht6brZFTrTpmh7Wr-M-59ulTRPatvAUEu0QBvqbrxhw/edit#gid=357252415", "Data!B:B"),MATCH(A2:A,IMPORTRANGE("https://docs.google.com/spreadsheets/d/1ht6brZFTrTpmh7Wr-M-59ulTRPatvAUEu0QBvqbrxhw/edit#gid=357252415", "Data!A:A"),0),1))})
but it is only providing me with the first row value, the rest of the column remains blank.
thanks in advance

fx is correct. make sure you run this first and connect your sheets by allowing access:
=IMPORTRANGE("1ht6brZFTrTpmh7Wr-M-59ulTRPatvAUEu0QBvqbrxhw", "Data!B1")
when connected use:
=ARRAYFORMULA({"Name"; IFERROR(INDEX(
IMPORTRANGE("1ht6brZFTrTpmh7Wr-M-59ulTRPatvAUEu0QBvqbrxhw", "Data!B:B"), MATCH(A2:A,
IMPORTRANGE("1ht6brZFTrTpmh7Wr-M-59ulTRPatvAUEu0QBvqbrxhw", "Data!A:A"), 0)))})
or try:
={"Name"; INDEX(IFNA(VLOOKUP(A2:A,
IMPORTRANGE("1ht6brZFTrTpmh7Wr-M-59ulTRPatvAUEu0QBvqbrxhw", "Data!A:B"), 2, 0)))}

Related

How to change the TextJoin range in google sheet dynamically based on empty cell

I want to join the text but the number of rows differ for each record. If I use the static range data is missing for few records, in below example 22Inch is missing,
Used the below formula. How to dynamically change the range.
=TEXTJOIN(",",TRUE,A3:A8,"")
try:
=TEXTJOIN(",", 1, A3:INDEX(A:A, MIN(IFERROR(1/(1/(ROW(A3:A)*(A3:A="")))))))
Can you test this one out:
=LAMBDA(z,BYROW(z,LAMBDA(a,REGEXREPLACE(TEXTJOIN(",",1,IFNA(FILTER(A2:A,XLOOKUP(ROW(B2:B),z,z,,-1)=a))),"^(.*?)\,",""))))({ROW();BYROW(A3:A,LAMBDA(z,IF((z<>"")*(OFFSET(z,-1,0)=""),ROW(z),)))})
Here's another formula you can try:
=QUERY(INDEX(LAMBDA(ζ,SORT(REGEXREPLACE(ζ,"^,",),COUNTIFS(A1:A,"",ROW(A1:A),"<="&ROW(A1:A)),1,LEN(ζ),))({"";IF({A3:A;""}<>"",,SCAN(,A2:A,LAMBDA(a,c,IF(c="",,a&","&c))))})),"limit "&ROWS(A2:A))

Concatenate merged cells with Google Sheets

I have this situation on Google Sheets:
I want to concatenate (=A2&B2) with a merged cell, but only the first cell has a value. I want to get the values of the column "Expected results". How I can detect the first value of each work office in this example?
You can use INDEX/AGGREGATE:
=INDEX($A$1:$A$9,AGGREGATE(14,4,(ISBLANK($A$1:$A$9)=FALSE)*(ROW($A$1:$A$9)<=ROW())*ROW($A$1:$A$9),1)) & B2
Edit for google sheets:
=INDEX($A$1:$A$9,LARGE((ISBLANK($A$1:$A$9)=FALSE)*(ROW($A$1:$A$9)<=ROW())*ROW($A$1:$A$9),1)) & B2
When merging a cell, the content appears only as if it were if the first cell of that block. Hence, you need to only use that first value as your reference. For this you need to block the reference, and it would look like this:
=($A$1&B2)
You can check more information about that in this link.
Try this in D2:
=ARRAYFORMULA(IF(B2:B="",,VLOOKUP(ROW(A2:A),FILTER({ROW(A2:A),A2:A},A2:A<>""),2)&B2:B))

Google Spreadsheet, use array formula with filter betwen date

Hy everyone,
I try a simple trick, Use an array formula with a countblank with a filter between date. Without array, its work great, with an array, it goes crazy. why?
I use a spreadsheet to follow the present or absent off people by month. (exemple sheet)
I try to like this by line and its work fine:
=COUNTBLANK(FILTER(D9:AU9,D8:AU8>=B4,D8:AU8<=B5))
When i try to apply this to every line, its goes crazy :
=ARRAYFORMULA(IF(A8:A19<>"",COUNTBLANK(FILTER(D8:AU,D8:AU8>=B4,D8:AU8<=B5)),""))
Where is my mistake?
In C8 try this formula
={""; Arrayformula( if(len(A9:A), countif(if((D9:AU="")*(month($D$8:$8)=month($B$3)), row(A9:A)), row(A9:A)),))}
and see if that works?

Can de search key of MATCH be a row of values?

I am would like to use the values in the name column (search key) and look them up in a table with the headers [name, regular, overtime].
The formula I am using is:
=ArrayFormula(index(rateTable, match(formName,workers,0),match(formType,rateTypes,0),0)*{formHours})
It works except the search key in the MATCH formula, does not reference every respective entry in the name column, but only works with one fixed reference to a cell.
Am I trying to use this formula beyond its capabilities? I'd like to know if I should stop searching. Thanks.
Here is a link to a copy of my sheet:
https://docs.google.com/spreadsheets/d/1sovuTB4zSTpl0RUHciYltr-pf8g4KPTgkYVE5lB4Ifk/edit?usp=sharing
=ArrayFormula(index(rateTable, match(formName,workers,0),match(formType,rateTypes,0),0)*{formHours})
for this task is best if you use VLOOKUP formula. paste in I2 cell:
=ARRAYFORMULA(IF(LEN(formName), IFERROR(VLOOKUP(formName, rateTable,
IFS(formType="Regular", 2,
formType="Overtime", 3), 0)) * formHours, ))
demo spreadsheet
INDEX doesn't work with arrays as needed for ARRAYFORMULA. Either…
use copied formulas rather than a single ARRAYFORMULA, e.g.
=IF(NOT(LEN(A2)),"",index(rateTable, match(C2,workers,0),match(G2,rateTypes,0))*H2)
and drag-copy it down column I,
or refactor your INDEX(,MATCH( use to rely instead on VLOOKUPs and HLOOKUPs.

Spreadsheets get unique names but ignore blank cells

I would like to use spreadsheets to get all unique names from Column A in a table but in the same time I would like blank cells to be ignored. So far I've got this formula that returns all of the unique names from column A but I don't know how to go about ignoring blank cells and not repeating values that have once been added previously.
Here is how my document looks so far. As you can see everything stops after Megan because there is a blank cell.
=IFERROR(INDEX($A$2:$A$90, MATCH(0, COUNTIF($I$10:I10, $A$2:$A$90), 0)), "")
Searched long and wide but came up with nothing, if anyone has any idea how one could do that I would really appreciate it. Thanks!
=unique(A2:A) should work
=unique(filter(A2:A,A2:A<>"")) to also ignore blanks
Yet another hack
=SORT(UNIQUE(A2:A))
Technically, this does not remove the blank result. But nonetheless puts it at the end of the list. You'll also benefit from the sort if you need it. 😁
You can use query:
=unique(query(A2:A,"select A where A<>''"))
You can use this code:
=IFERROR(INDEX($A$2:$A$90, MATCH(0, INDEX(COUNTIF($I$10:I10, $A$2:$A$90)+($A$2:$A$90=""), ), 0)), "")
should work

Resources