Google Sheets QUERY: Filter by a Cell Value
How to filter a Google Sheets QUERY by a cell value: the quote and ampersand pattern, dates with TEXT(), names with an apostrophe and Col1 notation for arrays.

A QUERY formula is a text string, so a cell reference placed inside the quotation marks is read as plain text, not as the cell's value. To filter by a cell, you close the string, join the cell with &, and open the string again. The Google Sheets QUERY Builder does this when you type a cell in the From cell box of a filter, so you do not have to count the quotes yourself.
Filter from a cell: the formula
Suppose you type a region in H1 and a start date in H2, and you want the values of column C for that region from that date on. In the builder, keep one column to show, C. Add a filter on B (Region) with a sample value such as North and H1 in the From cell box, and a second filter on A (Date) with the condition At least, a sample date and H2 in From cell. The value box is used only for the preview; the formula reads the cell. The query string becomes:
"select C where B = '"&H1&"' and A >= date '"&TEXT(H2,"yyyy-mm-dd")&"'"
Inside a full formula it looks like this, with a data range as an example:
=QUERY(Sales!A1:F, "select C where B = '"&H1&"' and A >= date '"&TEXT(H2,"yyyy-mm-dd")&"'", 1)
Read it from the outside in. The double quotes start and end each part of the text. The single quotes belong to the query language and wrap a text value. The & joins the parts, and H1 is replaced by the value you typed. Change H1 and the result updates.

Type the filter cells outside the data range, so that new rows of data do not overwrite them. If H1 is empty, the query looks for rows where the region is empty and usually returns nothing, which looks like a broken formula. The builder with a fixed filter is covered in Google Sheets QUERY: Group By and Sum a Column.
Dates from a cell with TEXT()
A date in a QUERY string must be written as the word date and a date in the form yyyy-mm-dd, in single quotes. A date cell contains a number, not text in that form, so the cell cannot be joined as it is. TEXT(H2,"yyyy-mm-dd") turns it into the right text.
and A >= date '"&TEXT(H2,"yyyy-mm-dd")&"'
The format code is fixed: yyyy for the year, mm for the month and dd for the day. Keep it in English letters even if your spreadsheet locale uses another language for the date. If the formula returns an error about the date, check that H2 contains a real date and not text that only looks like one. A real date is aligned to the right by default.
Values with an apostrophe
A name such as Liam O'Brien breaks the filter. The single quote inside the name ends the text value early, and the rest of the name is read as part of the query. When you set a rep filter to Liam O'Brien, the builder wraps the value in double quotes instead. In the finished formula it reads:
=QUERY(Sales!A1:F, "select F where C = ""Liam O'Brien""", 1)
The doubled double quotes are how a double quote is written inside a string in a Sheets formula. After Sheets reads the formula, the value sits in double quotes inside the query, and the apostrophe is safe.

There is one case the builder cannot solve. A value that contains both an apostrophe and a double quote cannot be written as one text value in a QUERY string. The builder stops with a message, and FILTER or a helper column is the better way to handle such a value.
Col1 notation for arrays and IMPORTRANGE
QUERY refers to columns by letter when the data is a normal range. When the data is an array in curly brackets, or the result of IMPORTRANGE, there are no column letters, and the query must use Col1, Col2 and so on, counted from the left.

In the builder, tick Use Col1, Col2… for such data. The columns in the query then become Col1, Col2, and so on, so a filter on the third column of an IMPORTRANGE reads Col3. If you leave the option off, the query returns an error about an unknown column.
IMPORTRANGE asks you to allow access the first time you use it. Until you do, the cell shows an error, and QUERY around it fails as well. Google describes both functions on its help pages for QUERY and IMPORTRANGE.
If a formula was written in Excel and should work in Sheets, use Convert an Excel Formula to Google Sheets.
Do it with your own data
Open the Google Sheets QUERY Builder, set a filter to From cell and enter the cell that holds your value. Copy the formula, type a different region or date in the cell and check that the result changes.