Get data in row with dropdown list - google-sheets

I created a dropdown list with a range in Sheet2 in Google Spreadsheets.
The dropdown is filled with a bunch of names.
When I select a particular item I want to update another cell next to it with the data that is on Sheet2 from another column.
For example Sheet2 looks like:
id,name,date
1,John,2015-04-29
2,Adam,2015-03-01
I select John in my dropdown list and I want to display the "date" column of John in another cell on Sheet1.

Assuming John is selected in C3 and your name/date data is in a range named NamedRange1 please try:
=vlookup(C3,NamedRange1,2,0)
If you wanted ID VLOOKUP would not be suitable as it does not "look to the left" and the conventional solution would be an INDEX/MATCH combination instead.

Related

Google Sheets referencing another sheet every nth row

In Google Sheets, I want to grab the text value from a sheet and put it every three rows in a separate sheet. I want there to be blank spaces in the rows in between.
For example, say I have a list of names on a sheet called "Customer Info" In Column A. On a separate sheet, I am keeping track of interactions with customers, and that data takes 3 rows. Every third row, I want to grab the name of the next customer from my sheet "Customer Info" and put it in column A of my sheet "Transactions."
I've been trying to find a way to use something like ='Customer Info'!A(x), and use a formula to get the value of x. I thought some variation of MOD would work.
Say Sheet2 is like:
In Sheet3 cell A1 enter 1 and in A2 enter:
=IF(MOD(ROW(),3)=1,1+MAX($A$1:A1),"")
and copy downwards. In B1 enter:
if(A1="","",index(Sheet2!A:A,A1))
and copy downwards:
You can change the number of empty rows by changing the arguments to MOD().
try:
=INDEX(TRIM(FLATTEN(SPLIT(QUERY(INDIRECT("Customer Info!A2:A"&
COUNTA(A2:A)+ROW(A2)-1)&"♀ ♀ ♀",,9^9), "♀"))))

is it possible to lookup a cell value and populate a drop down box with the results in a separate cell

I have a google sheet with all current staff information. I have a second sheet for when some piece of data needs changed. Last name, Location, job ect.
on second sheet I am looking to have someone:
Enter the user's first name in column B,
and or Last name in Column C,
I would like a drop down box generated in column D from the given info to contain all usernames found in the sheet with current information for all staff that have the given first and or last names provided.
Once a username has been selected, I can get all the pertinent data from that user with a vlookup from the sheet containing all staff info. For example if someone typed Scott in column B, I would like a drop down generated in column D with all staff that have a first name of Scott. Likewise if the last name was supplied and of course if both first and last was supplied.
Validation need to be done that's it,
1) Go to Staff Changes'!B2 and Data Validation> List from range & choose range from 'Staff Info'!B2:B
2) Select cell'Staff Changes'!D2 and Data Validation> List from range & range will be filter formula i.e 'Staffing Changes'N2:N.
Result
Few tweaks in vlookup:
I am not sure if you need username column twice if you don't need then change your vlookup formula from =vlookup(D2,'Staff Info'!A:K,10,0) to =VLOOKUP(D2,'Staff Info'!$G$1:$K,2,0)
Please provide access to trix in future so that changes & result can be shown in it.
UPDATE:
Use data validation as before & hide filter colum or use seperate sheet for filter formula & use query function in cell A3 =QUERY('Staff Info'!A:J,"select ' ',A,F,' ',' ',G,' ',I,' 'where A='"&A2&"' AND F = '"&B2&"' LABEL ' ''Date',' ''Current Last Name',' ''New Last Name',' ''New Building',' ''New Classification'",1) result wil be something like this
QUERY

Google sheet formula that finds row name and returns column headers based on marked cells

I'm trying to return the column headers for a row that is marked with an x. The row is selected from a name in the left column. I'm stuck here.
I can illustrate what I want to do by showing these images:
Start table
The result I want is this:
Outputs of the possibilities for the first sheet
I have put more information in my Example Sheet.
Link to editable example sheet
This formula should create a table (with a single formula) with the months in one column and the headers in the second column.
=ArrayFormula({A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)})
If you'd want to 'lookup' the months you manually type in you can wrap the above in a vlookup. Example:
=ArrayFormula(if(len(L4:L); vlookup(L4:L; {A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)}; 2; 0);))
You can check out both formulas in the copy of the sheet I've made in the spreadsheet you shared.

Google Docs: create drop down list using data from another spreadsheet

I need to populate a drop down list in a cell (let's say cell B2) of Spreadsheet A (using data validation) on basis of data located in Spreadsheet B (range - C3:C15).
How do I do that? Googled this for several hours - no luck.
Thank you.
Getting the items from another workbook, as opposed to another sheet in the same workbook is similar. It's a two-step process. First, you need to import the data you want to use for the validation items into the workbook where you want to make use of it, then connect it up as described in #uselink126's answer.
An example: Workbook 2 contains a list of fruit names in no particular order. The list has been assigned a named range Fruits for readability, but this isn't necessary. Workbook 1, Sheet 1 has a column of cells where we want to populate a drop-down with the items from Workbook 2.
Step 1 - Importing the data
Add another sheet to Workbook 1 and insert the following formula into cell A1:
=ImportRange("<key>","Sheet1!Fruits")
where <key> is the unique ID Google docs assigned when you created the spreadsheet. In the example, the items are sorted into alphabetical order as part of the import, and to do this you would enter instead:
=Sort (ImportRange("<key>","Sheet1!Fruits"), 1, true)
The 1, signifies column 1 is what to sort by, true means sort ascending. The cells in column 1 should populate with the sorted fruits.
Step 2 - Point the data validation to the imported list
On Workbook 1, Sheet 1, Select the cells you want to have the fruits as their drop-down data source.
- Right-click the selection and click on Data Validation from the menu. Set Criteria to List from a range and enter Sheet2!A1:A20
That's it. The drop-down chevrons should appear in those cells and when clicked the list of fruits should appear.
Note that this is "live" - adding an item of fruit to Workbook 2's list will also magically add it sorted in the drop-down list.
The format to access cells from another spreadsheet in Google Sheets is:
SheetName!CellAddress
For example, let's say you have a Google Sheet that contains 2 spreadsheets named: Sheet1 and Sheet2 (The names are listed on the tabs at bottom left hand side of each sheet).
In Sheet1 if you wanted to access cell B2 in Sheet2, you reference it by inputting: Sheet2!B2
In Sheet2 if you wanted to access cells C3:C15 in Sheet1 , you reference those cells by inputting: Sheet1!C3:C15
To specifically add cells from another sheet to a dropdown:
1) Select the cell you want the dropdown in
2) Right click on the cell and select Data Validation
3) In the dialog box, click the grid image in the Criteria input box
4) This will bring up the "What Data?" dialog box
5) Click on the tab for the sheet you want to access
6) Hold down shift and click on the cells you want to select (you will see the cell addresses show up in the input box in the "What Data?" dialog)
7) Click OK and you are set. The data will update if you make changes in the source sheet.
More info: https://support.google.com/docs/answer/186103?hl=en
Similar to rossmcm's answer but with a few tweaks because his answer didn't work for me:
=IMPORTRANGE(spreadsheet_url; range_string)
Where spreadsheet_url is The full URL of the spreadsheet from where data will be imported, and range_string a string, of the format "[sheet_name!]range" (e.g. "Sheet1!A2:B6" or "A2:B6") specifying the range to import.
Example:
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/1EwEn_2dSbgAlR7jJ7UT_MyE3h1-Biq3qoovfIGUnVlo/edit#gid=0", "Sheet1!A1:A7")
More info from Google DOCS Help!

Attempting to Query only data from cells that are not blank

I have a google spreadsheet with 2 sheets. The first sheet contains data that has been input by a form. Each form response will input data for the following "Timestamp", "Zone", "NPC", "Faction", "Amount", "Faction2", "Amount2", "Faction3", "Amount3", "Faction4", "Amount4", "Faction5", "Amount5".
Row 1 contains the above category names for each response input. The way the form works unfortunately is that each response is put into it's own column based on what Zone is chosen at the beginning as each Zone has different possible responses for the category. So the data is spread out from Columns C to Columns HC. Each row will only have one response per category name, but the category names are repeated and spread out.
I have been using the following query in Sheet2 to pull the information from whichever "Zone" that is selected from the E1 dropdown in the sheet.
=if(len(E1)=0,"Please Select a Zone in E1",query('Form Responses'!A2:IS,"Select * Where B = """&E1&""" "))
The problem is that it returns the entire Row for the Selected zone so the following information doesn't line up. Is there any way for me to return only the information from the Rows that have data in the cell. This would then line up the data into the correct Column for Sheet2
Below is a link to the Form with some sample data in it, the Cobalt Scar selection lines up as the responses are in the corresponding columns in the data sheet, but Crystal Caverns and Western Wastes do not. You can change selected zone to view the results in Sheet2 E1.
Also the sheet is a copy and can be edited by the public.
https://docs.google.com/spreadsheet/ccc?key=0AqEFpZnTydP-dFNNOV9sRzNRSldDUXRJX1pqSFZRYkE&usp=sharing
I haven't found an elegant solution to this type of problem, but that doesn't mean it's not solvable.
The solution I created on your sheets is easily manageable (only have to update the sheet with the area / column table), but it does take up a little more memory.
How it works:
The ArrangedData tab is the first 2 columns from Form Responses, then the "appropriate" columns (based on the selection made on sheet2; it picks the columns from a lookup on sheet5).
Then ArrangedData is filtered (based on the selection on sheet2 again) into sheet2.
Let me know if you have any questions about it.

Resources