Easier Way to VLOOKUP to the left w/ IMPORTRANGE? - google-sheets

I'm using a formula in Google Sheets that combines vlookup and importrange to look to the left in a separate spreadsheet. Here's the formula...
={
"Staff Name";
arrayformula(
iferror(
VLOOKUP(
A2:A,
{
IMPORTRANGE("1Ri5k_WNei8X9XJVWxrblSuEKS3680YcH3LobflvmzuALcsY","Directory!D2:D"),
IMPORTRANGE("1Ri5k_WNei8X9XJVWxrblSuEKS3680YcH3LobflvmzuALcsY","Directory!C2:C")
},
2,
0
),
""
)
)
}
But, let's say I need to look 6 columns to the left, instead of just 2. Do I need to do an importrange for every single column like the above formula? Or is there an easier way?
In other words, will my formula need to change to look like this below?
={
"Staff Name";
arrayformula(
iferror(
VLOOKUP(
A2:A,
{
IMPORTRANGE("1Ri5k_WNei8X9XJVWxrblSuEKS3680YcH3LobflvmzuALcsY","Directory!H2:H"),
IMPORTRANGE("1Ri5k_WNei8X9XJVWxrblSuEKS3680YcH3LobflvmzuALcsY","Directory!G2:G"),
IMPORTRANGE("1Ri5k_WNei8X9XJVWxrblSuEKS3680YcH3LobflvmzuALcsY","Directory!F2:F"),
IMPORTRANGE("1Ri5k_WNei8X9XJVWxrblSuEKS3680YcH3LobflvmzuALcsY","Directory!E2:E"),
IMPORTRANGE("1Ri5k_WNei8X9XJVWxrblSuEKS3680YcH3LobflvmzuALcsY","Directory!D2:D"),
IMPORTRANGE("1Ri5k_WNei8X9XJVWxrblSuEKS3680YcH3LobflvmzuALcsY","Directory!C2:C")
},
6,
0
),
""
)
)
}
Thanks for your help!

Related

Google Sheets Array Formula Return results where there is No Blank

I have this array formula in Google Sheets:
=IFERROR(ArrayFormula(K3:M3/A3),"")
I would like to return the results of table 2 only where there are no blanks in table 1
Here's my GoogleSheet:
https://docs.google.com/spreadsheets/d/1XLaN7aD95zOZZqoq3hSyCXu-I40oea-t-WOJ_Gc2kAQ/edit#gid=0
How can I do this in Google Sheets?
try this
=IFERROR(ArrayFormula(if(G3:I3="","",K3:M3/A3)),"")
Use the formula:
=ARRAYFORMULA( IF( (K3:M6*(G3:I6>0)/A3)>0, K3:M6*(G3:I6>0)/A3, "" ) )
Use if() and iferror(1/0), like this:
=arrayformula( if( G3:I6, K3:M6, iferror(1/0) ) )

Query/filter out blank non-specified columns from range

I would like this multiple-criteria query not to show empty columns.
=QUERY({H3:M11}, "select * WHERE
"&TEXTJOIN(" and ", 1,
IF(C3<>"", "Col2 = "&C3&"", ),
IF(B3<>"", "Col3 = '"&B3&"'", )), 1)
Besides, I would also like to know if it's possible to filter it outside a query formula. Currently, I have this formula made by #player0 which is excluding columns with values greater than 0, but I didn't manage to make it work for text.
=FILTER(FILTER(H3:M11, LEN(TRIM(QUERY(IFERROR(1/(1/H4:M11)),,9^9)))>0), {9;
LEN(TRIM(FLATTEN(QUERY(TRANSPOSE(IFERROR(1/(1/H4:M11))),,9^9))))}>0)
Link to the question where this filter formula was found.
Here's the sheet.
Thanks a lot.
try:
=ARRAYFORMULA(QUERY({H3:K11,
FILTER(L3:M11, TRIM(QUERY(L4:M11,,9^9))<>"")},
"where "&TEXTJOIN(" and ", 1,
IF(C3<>"", "Col2 = "&C3&"", ),
IF(B3<>"", "Col3 = '"&B3&"'", )), 1))

Array formula to join header values in a Google Sheet when row values equal "yes"

I saw this question but was not able to get it to work for me. Since it is already answered and from an year ago I felt it best to post a new question.
I have a sample sheet at: https://docs.google.com/spreadsheets/d/1EqNfTWcNFgkv2gdovnH7JpqU9V2HG5Vkoup8bhNqI7k/edit#gid=0
In F1 I want an array formula that will join the values of B1:E1 if B2:E = "yes".
Column G has the expected output.
This is what I came up with but it's giving error:
={
"output";
ARRAYFORMULA(
IF(
A2:A = "",
,
IF(
B2:E = "yes",
TEXTJOIN(", ", TRUE, B1:E1),
)
)
)
}
Try this out
=index(substitute(trim(transpose(query(transpose(if(B2:E<>"yes",,B1:E1)),,9^9)))," ",", "))
If the header contain spaces, use:
=index(substitute(substitute(trim(transpose(query(transpose(if(B2:E<>"yes",,substitute(B1:E1," ","❄️"))),,9^9)))," ",", "),"❄️"," "))
use:
=INDEX(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE(
IF(B2:E="yes", B1:E1&",", )),,9^9))), ",$", ))

Google sheets ArrayFormula with IMPORTRANGE always return same result

I have a Google Sheet that imports column "L" from another file based on the row number
=ArrayFormula(
IF(LEN(K:K),
if( ROW(L:L) = 1,
"Date",
IMPORTRANGE("https://docs.google.com/spreadsheets/d/123456123456lkjjj","Sheet1!D" & M1:M)
),""
)
)
other file (Sheet1)
The problem always return the first result
Try this:
=ARRAYFORMULA(
IFS(
ROW(L:L) = 1,
"Date",
K:K = "",,
True,
IFNA(VLOOKUP(
M:M,
{
SEQUENCE(ROWS(IMPORTRANGE("https://docs.google.com/spreadsheets/d/123456123456lkjjj", "Sheet1!D:D"))),
IMPORTRANGE("https://docs.google.com/spreadsheets/d/123456123456lkjjj", "Sheet1!D:D")
},
2,
))
)
)
IMPORTRANGE works once inside ARRAYFORMULA, so it is not possible to call it in a loop. But you can get everything with it and then loop through it.

Google Sheets SUMIF Text Formula

Ok so, I will arleady say that im not that good with excel and even worse on google sheets.
I would like to know if there is a formula that checks for the name of someone and then sums the points said person got to his total. Thank you very much!
https://docs.google.com/spreadsheets/d/1D4M8Dlao8yFHJulNDff-i2jZJeVGGY_gejbAfzWdhFo/edit?usp=sharing is the link if you want to check it out.
I assume you want Punti tot. (R:R) column to have the sum of all TA Brawl (column C:C), Notte (L:L) and 50 Shades (H:H; in this case any of the two players should be checked, right?) for every player.
You can use put this in R2 (do not forget to remove everything below R2):
={
"Punti tot.";
ARRAYFORMULA(
IF(
P3:P = ""; ;
SUMIF(A3:A; P3:P; C3:C)
+ SUMIF(E3:E; P3:P; H3:H)
+ SUMIF(F3:F; P3:P; H3:H)
+ SUMIF(J3:J; P3:P; L3:L)
)
)
}
Update: here is another solution using QUERY which is also sorts players by total points:
=QUERY(
{
FILTER({A3:A\ C3:C}; A3:A <> "");
FILTER({E3:E\ H3:H}; E3:E <> "");
FILTER({F3:F\ H3:H}; F3:F <> "");
FILTER({J3:J\ L3:L}; J3:J <> "")
};
"
select Col1, SUM(Col2)
group by Col1
order by SUM(Col2) desc,
Col1
label Col1 'Player',
SUM(Col2) 'Punti tot.'
";
-1
)
And you might want to use this in O2 for ranking:
={
"Posizioni Finali";
ARRAYFORMULA(
RANK(
FILTER(Q3:Q; Q3:Q <> "");
FILTER(Q3:Q; Q3:Q <> "")
)
)
}
This way same amount of points gives players the same place. Otherwise hysen would get 9th place and Imurshh would be 10th just because h goes before i.

Resources