I feel like this should have a simple answer. I have the following formula:
=query(DATA, "select * where A='Tues'")
I want it to reference the contents of a specific cell to use as a filter, for example A1, instead of manually inputting the filter ('Tues' for example) into the formula when I want to change it. Thank you!
Try-
=QUERY(DATA,"select * where A='" & A1 & "'")
or try:
=FILTER(DATA, DATA!A:A=A1)
Related
I'm new to google sheet. I have a column(E) with the date and another with a session(F), I want to merge them into one column with each date & different session just like the first few rows in column C.
I've tried "=ArrayFormula(concat(D2:D,concat(" ",F2:F5)))" in column C but only got the first date.
use:
=INDEX(QUERY(FLATTEN(FILTER(E2:E, E2:E<>"")&" "&
TRANSPOSE(FILTER(F2:F, F2:F<>""))), "where not Col1 starts with ' '", ))
see: https://stackoverflow.com/a/68775825/5632629
In your cell C1, try this formula:
=ArrayFormula(E1:E&" "&F1:F)
Well you can simply do concatenate cells like this:
CONCATENATE(E1, " ", F1)
to get what you want I think.
What you're looking for is a cartesian product. I don't have a single formula that does the entire thing for you, but I can suggest a two-step approach.
Get the cartesian product with this formula:
=ARRAYFORMULA(SPLIT(FLATTEN(E2:E9 & "|" & TRANSPOSE(F2:F5)), "|"))
This gives a pair of each date against each time in two result columns. You can then concatenate each row of them in a final result column.
i need help with the following formula:
IF(REGEXMATCH(LOWER(B3), JOIN("|",Keywords!H$2:H$13)),"unqualified","qualified")
B3 is in this Case the String "I need help". My problem is that id like to use the Formula
IF(REGEXMATCH(LOWER(B3), JOIN("|",Keywords!H$2:H)),"unqualified","qualified")
so i dont always need to match the Row with the Keywords. Otherwise i have Spaces in the join formular and the results are always "unqualified".
Does anyone has an idea how i can rewrite this formula into a more "scalable Version"?
I hope everything i explained was understandable.
Try this out. You can remove the LOWER and make the regex case insensitive
=ARRAYFORMULA(
IF(ISBLANK(B3:B),,
IF(
REGEXMATCH(
B3:B,
"(?i)"&TEXTJOIN("|",TRUE,Keywords!H2:H13)),
"unqualified",
"qualified")))
I solved my problem with this formula:
IF(REGEXMATCH(LOWER(B3), JOIN("|",QUERY(G$2:G,"select G Where G is not null"))),"unqualified","qualified")
Hi everyone,
I want to get all the rows where A=1, A=2. The query is very simple but I'm not sure why there is no output. I guess is the problem of the format for column A but I'm not sure what should I change in my formula so that the formula can work. Appreciate any help or advice!
A can't be both: 2 and 1. Instead try
=query(A3:C, "Where A = 2 or A = 1", 0)
It should have been OR not AND - it's impossible for any row in a particular column to have two values simultaneously:
=query(A3:C,"select * where A=1 or A=2",0)
QUERY() is good choice. You can also use FILTER() function like-
=FILTER(A3:C,A3:A>=1,A3:A<=2)
I want to change the cell address to string/text. For example :
AB123 --> "AB123"
I want to use it with indirect(), for example to refer to A1:A100 where the '100' is fetched from cell X1 -->
indirect( to_string( A1 ) & ":A" & X1 )
I didn't do indirect("A1:A"&X1) because since "A1" is static string so when i insert a new row on the very top so to shift down row 1, then the formula won't update automatically and will still refer to A1:A100 , in fact it should now refer to A2:A100 after the row insert. In this case i want to keep the A1 not as string so after insert it should updated to A2
What is the simplest way to do it?
Try this:
=cell("address", AB123)
This (or something like it) might also work instead of all that "indirect" stuff.
OFFSET is very good at defining changing ranges like that.
=OFFSET(A2,,,X1,1)
try:
=INDIRECT(ADDRESS(123, COLUMN(AB1)))
or:
=INDIRECT(ADDRESS(123, 28))
to get range AB123
I have a sample Spreadsheet such as
And I want to import data from this spreadsheet to another spreadsheet, but after comparing some data, such as
My noob formula for the selected cell name in the second image:
=Query(ImportRange("URL of first spreadsheet","sheet!B:D"),"Select Col2 where Col2=A.....(what to add here? this column 'A' is not working for comparing the names)
My Approach:
I will compare the values from the import range with the existing column i.e. previousSpreadsheet.name.A=thisSpreadsheet.this_name.A and compare every name and SELECT values accordingly for the next three columns (in yellow). I hope I'm clear.
What should I add here? Is my approach right? If not, What are the alternatives to achieve this?
Thanks.
EDIT
(following OP's request)
Also, can I compare two cols with one? such as where LOWER(Col2)='"&LOWER(A2)&"' or '"&F2&"' or Col2=A2 || F2 something like this? for comparing two cols with one?
If you start using more than one names as variables, you may want to consider using other alternatives for the where clause, like matches
=Query(ImportRange("URL of first spreadsheet","sheet!B:D"),
"Select Col2 where Lower(Col2) matches'"&LOWER({A2&"|"&F2})&"'")
Original answer
Please use
=Query(ImportRange("URL of first spreadsheet","sheet!B:D"),"Select Col2 where Col2='"&A2&"'")
(where A2 is the name you need)
Pay notice to the syntax referring the cell: single quotes ' double quotes" ampersand & cell A2 and again &"'.
No spaces in between
try:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, IMPORTRANGE("ID", "sheet!B:D"), {1,2,3}, 0)))