Google sheets - select multiple columns for data validation - google-sheets

I'm new on google spreadsheets, and I'm having this little problem:
I want to create a project manager with an external spreadsheet just for customer-info. In my "main-hub" sheet, I have created a dropdown menu on B11 which copys the customer names from the extrenal sheet. That works fine.
Now the problem I am trying to solve: I want to keep the drop-down menu on B11, i dont want to add any new drop down menus. Whenever I select an item from the menu on B11, additional information about the customer should be inserted into different cells in different columns. Example:
| __________ B11 __________ | __________ J11 __________ | __________ K11 __________ |
Selected Name dynamicly inserted data 1 dynamicly inserted data 2
Please keep in mind, I really don't want to add any new drop down menu, I want to keep only this one for the names of the customers.

What you're looking for is "VLOOKUP". This is a Formula where you can define a specific range and select the part you want to display. I've edited your spreadsheet.
=IFERROR(VLOOKUP(A2;'Customers static'!$A$2:$C$5;2;FALSE);"")
IFERROR Value, [value if error]
VLOOKUP Search key, area, index, is sorted

Seeing that you have not solved your answer. I have created a new sheet in your spreadsheet showing you a possible answer.
Possible solution
Basically you can have a dynamically expandable sheet with the use of ARRAYFORMULA.
Which is kind of basically repeat this operation for the whole range. In this case you just would need to put one formula for each column:
=ARRAYFORMULA(IFERROR(VLOOKUP(A:A;'Customers static'!A2:D;2;FALSE)))
Look how instead of using a single value for VLOOKUP you are using the whole range and ARRAYFORMULA will handle that. Therefore you just need to write the formula at the top of each column, changing the index for every single column in the original data.
You can take a look in the Raserhin's help on the sheet you have provided.

Related

How do I code a formula to apply to an entire column in Google sheets, even when you insert a new row?

I have a basic cash flow Google Sheet that I use to track my personal finances, cash in and out of my checking account.
Here's basically what it looks like:
Column A Column B Column C
Row 1 | Water bill | -50.00 | 400.00
Row 2 | Credit card | -300.00 | 100.00 >> the formula here is =sum(C1,B2)
Row 3 | Paycheck | 2000.00 | 2100.00 >> the formula here is =sum(C2,B3)
I project this out a full year. Anytime I want to add a row, I have to manually apply the formula in column C, and then I also have to fix the formula in the row just below it, which then fixes the problem for the rest of the sheet.
In Google Sheets, Is there a way for me to hard-code a formula for Column C that would allow me to insert a new row and always have it math perfectly without having to manually add the formula, and fix the formula in the row below it?
Let me know if there would be an easier way to do this by making fundamental changes to how it's setup - this is just how I've done it for so long, and I'm looking for a way to automate this going forward.
I've heard array formula might be helpful, but I'm not sure how to set it up.
There are many kinds of ArrayFormulas and LAMBDA functions. I suggest you look into them for different cases and uses. There is one kind in particular that would serve to your purposes:
=SCAN(0,B2:B,LAMBDA(a,v,a+v))
If you put this in C2 you'll have a cumulative sum row by row. Try it and let me know!
If you want to hide the results if column B is empty you can use another ARRAYFORMULA to check if B is empty it returns empty, either way returns the SCAN result:
=ARRAYFORMULA(IF(B2:B="","",SCAN(0,B2:B,LAMBDA(a,v,a+v))))
If you need to insert a new row in between then it's quite tedious as it will mess up the formulas below it, but if you just keep appending a new entry on the bottom row, then the formula will smartly mimic the behavior above it. Then you can simply do this:
Select the current last row, then click the small dot at the end and drag it down to as much as you want
OR, Ctrl+C (Copy) the last row, then select as much empty rows beneath it as you want, then Ctrl+V (Paste)

Select the last two names in google sheet

In my data sheet1, I want to use the 'Name in use' column (B) with the last two names with ARRAYFORMULA. 
In my data sheet2, I want column (B) to be repeated with the same code next to the column A get filled 
Please find the sample date sheet below  https://docs.google.com/spreadsheets/d/1_AWRjexJNAcgNGsmrBKU_8JYL03UbAGeiyy4oI8B9fU/edit?usp=sharing 
 Regards,
Nimal PereraSri Lanka
Sheet 1
Your formula seems fine, just the ArrayFormula() needs tweaking. As noted in the docs, ArrayFormula() takes in a range, rather than a single cell.
You would have to do something like this:
=ARRAYFORMULA(IFERROR(UPPER(TRIM(RIGHT(SUBSTITUTE(A2:A5," ",REPT(" ",60)),120)))))
Essentially you type in the range you'd like it to apply on. So at any moment, instead of selecting a single cell for that row, you select the range. If you'd want to apply it to the entire column, use A2:A. You even did it right on sheet2
Sheet 2
Your names seem to be importing correctly once Sheet1 is done right. To have the same code everywhere, use something like this:
=ARRAYFORMULA(IF(LEN(A2:A),"SSD",""))

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.

Autofill a column in Google Sheets as new rows are submitted through Google Forms

I have a google form that has fields taking up 7 columns in the response sheet. I have reserved the 8th column to compute few fields (basically a formula) and generate a unique ID for that response. I know that when new responses are added, I can drag the box of the 8th column field all the way down to the given number of rows to auto-fill the column. But this type of auto-fill requires a manual effort. What I want is an automated system to keep filling in the column with my formula.
I have tried pulling the column down beyond the current number of rows in a hope for it to auto calculate when the new row is added but a new response simply overwrites the entire row instead of filling in just the seven columns which deletes the 8th column in that row.
The spreadsheet is
https://docs.google.com/spreadsheets/d/1HM2dDRtkF_KlQ8SKoeW2YmjP2dttYAk1_4iCYBVEN8o/edit?usp=sharing
The responses fill up to column H (Member #3) and my desired column is column I (Registration ID) which is aided by column J, K and L.
You can try using
=ARRAYFORMULA(IF(ROW(M:M)=1,"Registration_ID",IF(C:C="UM-DAE CBS, Mumbai", "cbs"&"_"&J:J, IF(C:C="ICT, Mumbai", "ict"&"_"&K:K, IF(C:C="IISER, Pune", "iiser"&"_"&L:L,"waiting for a response...")))))
Just some explanation:
//This one is just to label the first row as Registration_ID so you can replace M:M with any column you want.
IF(ROW(M:M)=1,"Registration_ID"
My first time answering in Stack Exchange so I'm not familiar with the formatting.
Also a heads up, if you wanted to use ArrayFormula() with an If(AND()) or If(Or()) function, just know that the ArrayFormula() requires you to use arithmetic functions like "*" or "+" instead.
So IF(AND(A,B)) will be IF(A*B).
Use the "CopyDown" add-on for Google!
On your Google Sheet that your Form posts to, click Add-Ons > Get Add-Ons > type "copyDown".
This add-on quickly & easily allows the sheet to automatically copy the formula from one of your top rows (adjustable) to the rest of the form's submissions.
Love it!

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!

Resources