Search Value in Column - API Google spreandsheet - google-sheets-api

I have a worksheet with 4 columns, I would like to consult this Sheet through API, more specifically column B and find a specific search value, if it finds return the values of the row or column C, I tried through this documentation but without success
https://developers.google.com/sheets/api/reference/rest

Related

Google Sheets API querying - can you query multiple sheets at once?

I'm looking to create a searchable database from a Google Spreadsheet.
I've looked into what the API can do and I know you can query a sheet according to the gid ID. What I want to know is whether it is possible to query (so return matching search data) across the whole of a spreadsheet which has multiple sheets (and therefore multiple gids)?
Assuming your data is in Sheet1 and Sheet2 and the id is in column A (of both sheets), in Sheet3 enter the id to search for in A1 and the following in cell B1:
=query({Sheet1!A2:D;Sheet2!A2:D},"Select Col2,Col3,Col4 where Col1 <>'' AND Col1 = '" &A1&"'")

Google Sheets Query() Function Returning Unexpected Data

I am having trouble with the QUERY() function in Google Sheets. I'm not certain I am using the correct function to generate the required data. I am far more comfortable with T-SQL, but my wife needs a mailing list generated from her current google sheets.
The facts:
Sheet2 is populated with data from B3:K150
I have a list of names in Sheet2, Column B.
I have a list of addresses in Sheet2, Column G
Sheet1 contains no data other than the data populated in Column B (See below)
Sheet1, Column B is populated with a unique list of names from
Sheet2, Column B using =Unique('Sheet2'!$B$3:$B$150).
Goal:
I would like to populate Sheet1, Column C with Sheet2, Column G
WHERE Sheet1(ColumnB) = Sheet2(ColumnB)
Obviously, using SQL, we would write this as such:
SELECT [Sheet1].[ColumnB]
,[Sheet1].[ColumnC]
FROM [Sheet1]
INNER JOIN [Sheet2]
ON [Sheet1].[ColumnB] = [Sheet2].[ColumnB]
What I have tried:
INSERT the following formula into Sheet1!C3:
=QUERY(Sheet2!B3:K150,"SELECT G WHERE B ='"&Sheet1!B3:B150&"'",0)
Sheet screenshots:
What am I missing?
This worked well for me:
=unique(query(Sheet2!B3:G150,"select B,G"))
as posted by user: pnuts in comments above.
Try this in Sheet1C3 =Arrayformula(if(B3:B=Sheet2!B3:B,Sheet2!G3:G,"")) Let me know if you need me to explain the formula.

Find value in column, based on 2 criteria

I have a file with 3 columns. Column A contains 300,000 rows, with about 200 separate IDs, all duplicated at least 1,000 times. Column B contains the date for each of the rows. Column C contains the values that I need to extract.
Each of the 200 IDs in Col A can have multiple values (e.g. ID 1234 might have dates 1/1/2001, 1/3/2001, 1/2/2015, etc). Similarly, each date on Col B will have multiple IDs (e.g. 1/2/15 might have IDs of 1234, 1874, 1930, 6043, etc).
In a nutshell, I need to check the values in Col A and Col B to find the relevant ID in Col A and the maximum value in Col B, and return the value in the relevant cell in Col C.
I've looked at Index/Match examples, but they don't seem to be suitable. Is there any suggestions on a macro I could run, that would accomplish what is needed.
Use this array formula:
=INDEX($C$1:$C$300000,MATCH(1,IF(($A$1:$A$300000="1234")*($B$1:$B$300000=MAX(IF($A$1:$A$300000="1234",$B$1:$B$300000))),1,0),0))
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
Change the "1234" to a reference cell with the appropriate ID.
You can accomplish this using array formulas. To start, you can retrieve the maximum date in column B when column A is 1234 using the below formula. Keep in mind that you have to use Ctrl-Shift-Enter when you finish typing an array formula.
{=MAX(IF($A$2:$A$24=1234,$B$2:$B$24))}
Note that you will need to change the ranges to include all of your data, rather than my test data on rows 2-24.
Now that you have a formula to retrieve the max date, you can put that inside an index/match and, again using Ctrl-Shift-Enter, use the below array formula to retrieve the value in column C for a row matching 1234 and the maximum date.
{=INDEX($C$2:$C$24,MATCH(1234&MAX(IF($A$2:$A$24=1234,$B$2:$B$24)),$A$2:$A$24&$B$2:$B$24,0))}

vlookup if name is matched display employee id

Ive never used vlookups i have a spreedsheet not sure if this is the right function. I have two sheets
Sheet 1
first name last name username
Sheet 2
first name last name employee id business unit
I need in column D on sheet 1 to have employee id ive below. Pay no attention to column letters and sheets because i moved to another sheet to try getting this right.
=MATCH(B11,Sheet1!C:C,0)
Any help is much appreciated.
So you realize you have to match both first and last names? There are several ways to accomplish this depending on how many employees you have in sheet 2: a) small list could a two-column search using array formula; b) large list just create another column in both sheets joining last & first names and do a MATCH or VLOOKUP on them.
Since your needs are simple and to illustrate option (b):
Insert a column in both Sheet1 and Sheet2 after the "last name"; you should now have an empty column C in both sheets.
Assuming you have column headers in row one, and thus data starts in row two, set cell C2 in both sheets with function =B2&","&A2, then fill-down that formula on both sheets in all rows.
Set Sheet1 cell E2 to formula =VLOOKUP(Sheet1!C2, Sheet2!$C:$D, 2, False), and fill-down that formula in all rows.
Voila, employee IDs on Sheet1. I do have to say this is so Excel 101. There are all sorts of examples and tutorials on this easily found using even the most trivial Google searches.

Count IF multiple criteria/data types match

I'm looking to generate a report to list the number of Cities/Towns that don't meet a certain criteria so on Sheet 2 I have an alphabetical list of all the cities/towns.
I want to do a look up/count if function to state if A2(Sheet 2) can be found anywhere in Column D on Sheet 1 then count it if the date in column L (sheet 1) matches the date in Cell $E$1 (sheet 2) and Column A in Sheet 1 is greater than zero.
I originally done this formula but it is returning an error.
=COUNTIFS(PickData!D:D,Sheet1!A2,PickData!L:L,Sheet1!$E$1,PickData!A:A,PickData!A:A>0)
Is there any other formulas that I'm currently not thinking of? Or is it possible to do this via VBA and it returns the value in to column B either True if it matches or False if it doesn't?
Thanks
Al
The problem with your previous formula is in the final criteria. Update to:
=COUNTIFS(PickData!D:D,Sheet1!A2,PickData!L:L,Sheet1!E2,PickData!A:A,">0")