How do you convert a String to Object in Google Sheets? - google-sheets

So I'm making a dependent dropdown column in Google Sheets that has a bunch of different things of a type. I've named the ranges I want to use and I've got column A with those names in the dropdown. The problem is, I can't use the contents of column A to reference in column B's data verification.
E.g. I select Tech in column A, column B reads that as "Tech" when I want it to be able to reference the named range Tech. How to you convert from the string "Tech" to the named range Tech? Is there a way without using a stupidly long nested IF on every single row of B column's data verification?
Thanks in advance :)

Related

In google sheets extracting words from column based on reference column

In this scenario, I have a reference column (A) of 6 types of devices, and a second column (B) of several thousand specific device names including the word from the reference column in the string.
I am trying to extract into a new column (C), from the column B just the relevant word from the string that corresponds to the reference column.
So far have been unsuccessful in finding the right working formula.
You can use VLOOKUP function to search particular data and get desired result.

Import data between Google Sheets depending on whether specific data matches

I am including a quick screenshot that shows my question in a slightly more logical way, but basically I have two separate files, and would like to pull data from one into the other from specific locations, IF the names are matching from one cell to the other. Hopefully that makes sense:
Importing specific data between sheets if specific cell text matches
Update
Here is the sheet where the data is being pulled FROM:
https://docs.google.com/spreadsheets/d/1sfrmjqULdw4ELRIBmDURzlnIN0EzvpMCwHAmj8SuTMU/edit#gid=0
Here is the sheet where I would like to pull the data INTO:
https://docs.google.com/spreadsheets/d/1HvPGl0ZjAO29DPTDkmpMVu9GFQIUJHqxOZF_itwt1to/edit#gid=1458193311
I should also note, that while I somewhat understand that I can ImportRange and specify some details, how do I specify a range related to a specific name, if that range is different for each name?
I.E. Student 1 has data from A2:D10, but Student 2's data is F2:J10...etc.
Can we specify column and rows according to the position of a name?
From the question
how do I specify a range related to a specific name, if that range is different for each name? I.E. Student 1 has data from A2:D10, but Student 2's data is F2:J10...etc.
If the reange doesn't include a key, then you should make a relationship table setting for each name the corresponding range reference as text, then use VLOOKUP, QUERY, FILTER, INDEX/MATCH to get the corresponding range reference.
Let say that we add a sheet as set it's name as Table. Then con Column A there are the names and on Column B the corresponding ranges reference. If the name to be imported is on A1, the formula to use could be the following:
=IMPORTRANGE(spreadsheet_key_or_url,VLOOKUP(A1, Table!A:B,2,0))
Thanks #Ruben! I ended up using the following formula with a Named Range (StudentLookup), and then edited which column it pulls from, for each corresponding cell and it's data:
Cell B6: =INDEX(StudentLookup,MATCH($A6,other!$A$1:$A$9,0),MATCH($B$3,other!$A$1:$Z$1,0))
^for data I wanted in that cell and then for the next cell and so on:
Cell C6:
=INDEX(StudentLookup,MATCH($A6,other!$A$1:$A$9,0),MATCH($B$3,other!$A$1:$Z$1,0)+1)
And I also just pulled the data directly from the other workbook into another sheet in this workbook for easier reference. Thanks again!

Query Importrange in Google Sheets Not Importing Correctly

We are using Google Forms to collect data on our students. They use the same Google Form for all students, but as part of the form, they are asked the students name.
The data that ends up being collected you can see on the tab Form Responses 1 on the Google Sheet linked here.
I am attempting to use ImportRange to create a tab for each of the students. The formula that I am using for just one of the students is...
=QUERY(IMPORTRANGE("1nJANDP1fiQunxfxEf-EjwJrnIRICv6kLhYYY9XBXtD4", "Form Responses 1!A:I"),"SELECT * WHERE Col3 = 'Adam N.'")
You can take a look at the tab called Adam N. and you'll see it is kind of working.
One thing that doesn't seem to be working is when there is a text value in columns E-I, that text value doesn't end up showing on the Adam N. tab. Any ideas how I can get both the numbers and the text values to show up?
The other thing that seems to be a problem is the fact that on the Adam N. tab, the very first row has the same headers as the Form Responses 1 tab, but it also has the very first line of data. Any way to remove that?
Importrange is not needed since you are 'importing' from within the same spreadsheet. Also, I'd recommend using the (optional) header argument in query().
It is often noted that users are tempted to mix data types within a column. The query() function will give undesirable output. If a column is intended for numeric values then only numerical values must reside in that column. Date columns must only contain dates and text columns only contain text values.
This does not mean that numbers cannot appear in a text column as long as they are in a text format. So it is important to plan the columns in a table to make sure this rule is maintained regardless if the data table is created manually or via submissions from a Google Form.
Generally, the query() function will assume the greater number of cell types in a column to be that data type. For example, if there are 100 numbers and 20 text values in the same column then a numeric value will be assumed for that column. There is a good chance the text values will just be ignored. One way to avoid this, would be to convert everything to text.
See if this works
=ArrayFormula(QUERY(to_text('Form Responses 1'!A:I),"WHERE Col3 = 'Adam N.'", 1))

How to apply arrayformula to a series of columns

I'm trying to make a spreadsheet to track membership for an organization.
Basically my design is an input sheet with columns of names associated with expiration dates, then another sheet that collects all the unique names and all of their associated expiration dates, and then one last sheet that filters the names into only those with expiration dates in the future.
I am able to collect all the unique names into one column using an arrayformula, but I am stuck trying to do a lookup operation of some kind that, for each name, will look for the name in each column and if it appears then it will add the associated expiration date to it's list (and otherwise add a blank cell, and then I can filter out the blank cells).
Is there a way to use vlookup or anything else in an arrayformula to do a series of operations for all columns in a range? Also, I want to use arrayformula because I want the formula to be infinite so the spreadsheet can keep growing. I've tried using
=ARRAYFORMULA(IF(ISERROR(VLOOKUP(A1:A,Sheet1!A2:200,1,FALSE)),,Sheet1!A1:1))
But vlookup, and anything else I tried like match, interprets Sheet1!A2:200 as a single range and performs a lookup only in the first column and does not do a separate lookup in each column.
For example, I might have this input on Sheet1
And want this result on another sheet
I suspect the combination of what you would really like and what is reasonably practical is a script but the following is an array formula, though would be cumbersome to extend and does require copying down (from B1):
=split(if(ISERROR(match(A1,Sheet1!A:A,0)),"",Sheet1!A$1)&"|"&if(ISERROR(match(A1,Sheet1!B:B,0)),"",Sheet1!B$1)&"|"&if(ISERROR(match(A1,Sheet1!C:C,0)),"",Sheet1!C$1),"|")
Assumes a unique list of names in ColumnA, such as created by:
=unique(QUERY({Sheet1!A2:A6;Sheet1!B2:B6;Sheet1!C2:C6},"where Col1 is not NULL"))
in A1.

Script to delete columns based on list of possible values in row 1

I would like a script to delete columns in a Google Spreadsheet if the contents match a list of approximately 30 possible text strings. e.g. Custom Variable 1, Custom Variable 3, Custom Variable 9, etc.
I'm new to Google Scripts. I've searched this forum but haven't found a starting point that handles my specific situation -- deleting columns based on a list of string values rather than a single value or value input from a dialogue box.
Any help would be greatly appreciated.
Scott C
If I'm understanding what you're asking, you wish to read through a column and compare a list of values to the value in each row of that column. If that column contains any one of those 30 values, delete that column.
One way you could do it:
Hard code an array that contains all of those values you have in mind. Loop over the column you desire, storing each value into an array (So you would have two arrays total when you're done. One with the hard coded values, the other with the column values). Then, take those values from Array 2, and see if they match any of the words in Array 1. If one of those values matches your list, delete that column.

Resources