I have 2 sheets with values like :
Sheet 1, column D : SUPER iPhone X 16GB
Sheet 2, column B : iPhone X
I would like, in Sheet 1, to display the matching value from Sheet 2 (in this example "iPhone X")
I have tried many Vlookup like this but cannot find the right one :
=VLOOKUP("*"&D6&"*";Sheet 2!B:B;1;FALSE)
As requested I have created a sample spreadsheet with 2 sheets and sample data you can test here :
https://docs.google.com/spreadsheets/d/1OHsS5SyvzHvJaRtqKXVmCSSDeKA3iqX5JC2qE8WHPw0/edit?usp=sharing
Put it into B2
=ArrayFormula(QUERY(IF(ISERROR(FIND(LOWER('Feuille 2'!B:B);LOWER(A2)));;'Feuille 2'!B:B);"select Col1 where Col1 is not null limit 1";0))
try:
=VLOOKUP("*"&D6&"*"; 'Sheet 2'!B:B; 1; 0)
Related
For this sample table:
A
B
C
D
E
1
Range!A1:C5
URL1
= Formula here
2
URL2
3
URL3
4
...
I have this working formula in C1:
={IMPORTRANGE(B1, A1); IMPORTRANGE(B2, A1); IMPORTRANGE(B3, A1)}
A1 contains the range to pull from the target Sheets.
Links to the target Sheets are found in column B.
(This is a simplified example. My actual Sheet has 21 entries in column B.)
Question:
If I will have to add/remove URLs in column B, I have to adjust the formula in C1 and add/remove IMPORTRANGEs.
I would like to have a formula that automatically adjusts to the entries in column B.
Solutions tried:
I tried this, but it did not work:
={JOIN("", ARRAYFORMULA(IF(LEN(B1:B), "IMPORTRANGE(""" & B1:B & """, """ & A1 & """); ", "")))}
The JOIN function returns a text that should be identical to what the array { ... } parses as a formula. But it doesn't. Wrapping it with INDIRECT also does not work.
Any suggestions on how I could make this work?
if by "working formula" you mean valid formula that returns data then only thing you can do is hardcode it like this:
=QUERY({
IFERROR(IMPORTRANGE(B1, A1), {"","",""});
IFERROR(IMPORTRANGE(B2, A1), {"","",""});
IFERROR(IMPORTRANGE(B3, A1), {"","",""})},
"where Col1 is not null", )
A1:C5 = 3 columns = {"","",""}
you can generate formula dynamically with arrayformula but the result will be always a text string and not active formula. tho if you wanna go this way you will need a script that will convert your text string into active formula. example:
https://stackoverflow.com/a/73119313/5632629
https://stackoverflow.com/a/61819704/5632629
I am building a reporting sheet that automatically extracts hours worked by person, date, and project from an aggregated sheet and transposes the data horizontally to a different spreadsheet.
The origin sheet looks like this:
The target sheet looks like this for each employee:
I am trying to figure out a function that extracts the relevant data from origin based on the name, project, and month values contained in row 2 of the target sheet. The origin sheet lists several more employees horizontally and several years vertically. I know I need the importrange function, but I am struggling with finding an extraction function based on the name, project, and day.
I would be very grateful for any suggestions :) Thanks in advance!
Try this series of formulas:
Output (D7):
=transpose(query({Sheet1!C3:C,indirect("Sheet1!"&address(3, Y3, 4)&":"&left(address(3, Y3, 4), 1))},
"select Col2 where
Col1 > date '"&text(date(C2, month(A2&1),), "yyyy-MM-dd")&"' and
Col1 < date '"&text(date(C2, month(A2&1) + 1, 1), "yyyy-MM-dd")&"'"))
I also added some formulas in other cells that are needed by the output, these are:
Y1 = match(L2, Sheet1!A1:1)
Y2 = if(L2 = query(transpose(Sheet1!1:1), "where Col1 is not null order by Col1 desc limit 1"),
counta(Sheet1!1:1)+countblank(Sheet1!1:1),
match(regexextract(join(",", Sheet1!1:1), L2&",*([^,]*),"), Sheet1!1:1))
Y3 = Y1 + match(P2, indirect("Sheet1!"&ADDRESS(2, Y1 + 1, 4)&":"&ADDRESS(2, Y2 - 1, 4)))
Output:
I have row 1 containing some dates (undetermined number, because end formula will be a dynamic number) and I want row 5 to display the average of every column that has a date as a header.
Trying to have this array formula work :
arrayformula(iferror(
if(B1:1 = "",,
AVERAGE(
indirect(
SUBSTITUTE(ADDRESS(1,COLUMN(B1:1),4),"1","")
& 7 & ":" &
SUBSTITUTE(ADDRESS(1,COLUMN(B1:1),4),"1","")
)))))
I think I did isolate the problem in the arrayformula, I can't see where the problem lies with it ?
Here's a screenshot :
and here's the link to the spreadsheet :
https://docs.google.com/spreadsheets/d/1GbIWwv0lq6nVdn4dHkSO0-QqZYEPCwJtntCu8wcSd9Q/edit?usp=sharing
QUERY method:
=ArrayFormula(IF(B1:1="",,IFERROR(VLOOKUP(COLUMN(B1:1),QUERY(SPLIT(FLATTEN(TRANSPOSE(COLUMN(B7:7)&"♦"&B7:1000)),"♦"),"select Col1,avg(Col2) where Col2 is not null group by Col1 label avg(Col2) ''",0),2,FALSE),)))
MMULT method:
=ArrayFormula(IF(B1:1="",,IFERROR(MMULT(N(TRANSPOSE(ROW(B7:1000)^0)),N(B7:1000))/MMULT(N(TRANSPOSE(ROW(B7:1000)^0)),N(B7:1000<>"")),)))
I am trying to import several ranges from 8 different spreadsheets in to one master list.
This is my first Sheet.
This is my second Sheet.
This is my master list Sheet.
For now, I am testing it on just 2 spreadsheets. Will add the remaining once I figure this out.
So on my master list sheet, A4, I have this code
=query(
{
importrange("https://docs.google.com/spreadsheets/d/1scqPKhWpbZeOK_iYR7EaypNxMhh__V_O2FLUjbjrNFc/edit#gid=0","Scholarship Applicants Database!A4:W");
importrange("https://docs.google.com/spreadsheets/d/1PkBWxUG_0BG4gNhXFGHInSdVI5nMo4FReRpCQIVVs3w/edit#gid=664164578","Scholarship Applicants Database!A4:W")
},"Select * where Col1 <> ''")
Which works well. Then on Column X, these code does not work.
=query(
{
importrange("https://docs.google.com/spreadsheets/d/1scqPKhWpbZeOK_iYR7EaypNxMhh__V_O2FLUjbjrNFc/edit#gid=0","CDP Scoring Sheet (Initial)!G4:J");
importrange("https://docs.google.com/spreadsheets/d/1PkBWxUG_0BG4gNhXFGHInSdVI5nMo4FReRpCQIVVs3w/edit#gid=664164578","CDP Scoring Sheet (Initial)!G4:J")
},"select * where A = '"&$A4&"'")
What I am trying to do here is, import the ranges from Sheet1 and 2, from this sheet (CDP Scoring Sheet (Initial)), Column G4 to J, with the condition that Column A of Sheet 1 and 2 matches Column A of my Master list. Error I am receiving is "Unable to parse query string for function QUERY parameter 2: NO_COLUMN: A", I then change the "A" on the "where" part to "Col1", I get the error "Query complete with an empty output" and the result of "#N/A".
I also thought of changing my importrange from "G4:J" to A4:J" but I know it's not right cause it will then pull out the data from columns A to F which I no longer need.
Help please.
try:
=QUERY(
{
importrange("1scqPKhWpbZeOK_iYR7EaypNxMhh__V_O2FLUjbjrNFc", "CDP Scoring Sheet (Initial)!A4:J");
importrange("1PkBWxUG_0BG4gNhXFGHInSdVI5nMo4FReRpCQIVVs3w", "CDP Scoring Sheet (Initial)!A4:J")
},
"select Col7,Col8,Col9,Col10
where Col1 = '"&$A4&"'")
I have the following sheet:
https://docs.google.com/spreadsheets/d/1GcC47i7193Hjt0QbTQ5OT_2SZQjPO_4wKmKKMwy_hQE/edit?usp=sharing
I need to get the date (from row 1) for each of the products (col a) corresponding with the col one after the last value in each row.
EG
For product A it would be 1/2/2021
For product B it would be 1/3/2021
To raise the limitation of the VLOOKUP formula by JPV,
Assuming there's only one "D" per row
you can use the following for any number of x's in any number of rows
={"Product","Date";
QUERY(INDEX(SPLIT(FLATTEN(IF(B2:D6="x", A2:A6&"_"&B1:D1,)),"_")),
"select Col1, max(Col2) where Col2 is not null
group by Col1 label max(Col2) '' ",0)}
Assuming there's only one "D" per row, in B8 try
=filter($B$1:$D$1, filter($B$1:$D$6, $A$1:$A$6=$A8)="D")
and fill down.
For a single formula (array output) try in B8
=INDEX(VLOOKUP(A8:A12, SPLIT(FLATTEN(IF(B2:D6="D", A2:A6&"_"&B1:D1,)), "_"), 2, 0))
See if that helps?