Align imported data with manual input data in a Google sheet - google-sheets

I have two sheets, one with product names (sorted alphabetically) in column A, stock levels in column B.
Sheet 1
The other 2nd sheet with the same products in column A and stock levels in column B but populated by "importrange" but with columns C and D manually populated with customer names.
Sheet 2
What I'd like to do is, if a new product is introduced in the 1st sheet and it is positioned alphabetically in (let's say) row 3, then have a new row appear in the 2nd sheet.
Sheet 2 ideally
Currently, if a new product is introduced, the 2nd sheet will show the product and stock level, but the manually entered data in columns C and D will then be out of sync by one row.
Sheet 2 currently
Is there a way of automatically inserting a full row when the new product is imported to the 2nd sheet if I'm using "importrange"? If there is, can someone please help me here with the formula or code.

Basically what the OP is asking is how to keep the spatial/positional relation between two data sets. One alternative is to adopt the use of "keys" and "foreign keys".
Let says that a row represents a record.
A key is an unique value that used to identify a record.
A foreign key is a value added to a record to relate it with a record from another data set
Applying the above to the question case:
On Sheet 1 add a new column to hold the key for each row. When a new record is added the key of the other records should not be changed and a new key should be assigned to the new record.
Create a table of for the values of Sheet 2, columns C and D, and add to each record a key.
NOTE: This is the table were you should do the manual input.
Create a relation table having two columns one for the keys of the records on Sheet 1 and another for the records of Sheet 2, Columns C and D.
NOTE: I will not discuss here the arity of a relation concept as it will make the answer too long.
On Sheet 2, use IMPORTRANGE to get the values from Sheet 1, including the keys for each record.
Add a lookup formula (VLOOKUP / INDEX-MATCH) to get the related records from the table created on step 2 by using the relation table created on step 3.
Related
Synchronize independent spreadsheet rows, filled by IMPORTRANGE()
Associating row data with importrange data in a new workbook on Google Sheets

Related

How to get specific values of items from other sheets based on column names in the master sheet?

To describe my problem here is my sheet
Master sheet
Here, From Column E onwards there are different attributes for each of the items in column A.
Now, I have a subsheet based on the type of the items as listed in column B, here
Subsheet
Here we can see from Column C onwards attributes of the items in column A. In this case, the other attributes from the master sheet above that are not mentioned do not apply to these items and therefore will be blank in the master sheet.
My problem is to populate the attributes of the corresponding items from the subsheet that are in column C to F, in the master sheet where all the attributes are listed. I only want to add those values that exist in the sub sheet and leave the rest blank.
Here is a sample sheet with the desired output. There is a Master sheet and an Subsheet named DEF. The Master sheet has to lookup the values from the Subsheet and filled the appropriate cells based on the reference from column A and B of the Master sheet.
https://docs.google.com/spreadsheets/d/1lNPPhTr7_N0N8CA7BLyO9JhYGd1Hx0c6Q0Uq4Wdt_GY/edit?usp=sharing
try in D2:
=INDEX(IF(A2:A="",,IFERROR(VLOOKUP(A2:A&B2:B, {DEF!A:A&DEF!B:B, DEF!C:Z},
IFERROR(MATCH(D1:P1, DEF!A1:Z1, 0)-1, 100), 0))))

Google Sheets associate unique

I have 1000+ items (Game Names) in Sheet1 with some duplicates. In Sheet2 i use "unique" function to remove the duplicates and get them sorted alphabetically. Next to each record (2nd column) i assign Publisher values.
The problem is that if I add a new record in Sheet1, the record will be added in Sheet2 but the values from 2nd column are staying in place without matching or following the original content. I believe the issue appears because sorting is applied
Sheet1
Sheet2
So if i add a new entry "Abacus" in Sheet1, it will sort alphabetically again in sheet2 but publishers value will remain in place they will not follow the sorting

On Google Sheets, how do I 'attach' the value of a cell to the value of the cell on the left?

I have a table with 3 columns, say A, B and C, though only column C is editable by the user.
Column A contains values all from another sheet - the number of values in this column can change as values are deleted or added to the other sheet (EDIT: new values can be added to any part of the other sheet, not just the bottom).
Column B is a uniquely sorted list of the values of Column A.
Column C is currently just a normal column that takes values from the user.
When a user enters a value in a Column C cell, they do so based on the cell to the left (in column B). However, as the values in the other sheet can change, values in column B can be deleted or move up or down a row, or new values can appear anywhere in this column B.
Somehow, when the user puts "bar" into a cell in column C on row X and the value of column B on row X is "foo", then rather than "bar" always just staying in cell CX: 1) when "foo" changes it's row to row Y (because another value has been added to or removed from column B, or the first letters of the value in BX have been changed), "bar" should also move to row Y 2) if "foo" is completely removed from column B, "bar" should also be removed from column C 3) new values in column B should have blank column C cells to the right of them.
Eg say the table looks like this
B: C:
apple Rsdne fwe
banana Fg fdsg gse
grape Awtoi fje
lime Wpe fjweo
orange Jbob
If on the other sheet: a new value "kiwi" is added, "orange" is changed to "clementine" and "bananas" is removed, after all this the table should then look like this:
B: C:
apple Rsdne fwe
clementine Jbob
grape Awtoi fje
kiwi
lime Wpe fjweo
Is this / any of this possible? If so, how is this done?
Data entry should happen in a fixed table and not into a moving structure. Changing the association of a data entry row to a different parameter is simply bad data architecture. There isn't a simple formula solution to counter that.
My advice is to step back and determine what you want to achieve, then design a process that is fit for that purpose.
Creating a unique list of values from a hidden column is a reporting technique. Then this report is getting mixed with data entry. These two things, i.e. data entry and reporting should never happen on the same sheet.
Create a sheet that has all the possible unique values in a constant data entry table. Let the user enter their values into that DataEntry Table. New values can be added to the bottom of the table. If Orange is changed to Clementine, don't delete the row for Orange, just leave it and add a new row for Clementine.
Then you can create a report that takes the duplicates from your initial first sheet, creates a list of unique values and then uses lookups formulas to pull the user entries from the DataEntry table.

Sort Range Ignoring "" Flavor of Blank on Google Sheets

I have a spreadsheet with 2 main columns.
Column A is the student's name.
Column B is the student's grade.
Other columns (not shown) list various information about the student that the end users input.
End users click on the Data Validation Arrow to select the student in Column A, and the student's grade is auto populated in Column B.
The formula in Column B is:
=IF(A2="","",Index(All!$B:$B,Match(A2,All!$A:$A,0)))
The All sheet contains a master directory of the Students and their Grade level assignment.
The Problem:
When users attempt to re-sort the data using the Sort A-Z menu option in B1, it includes the blank cells in the sort - The blank cells come first, moving all the relevant data to the bottom of the sheet.
I understand that G-Sheets considers "" to be text. Is there another method to write my formula that would keep the Grade column blank, but allow for the sorting feature to function as end users would expect?
You can implement two additional comments where you filter the results before sorting them:
=SORT(FILTER(A2:B,not(B2:B="")),2, true)

Google Sheets query + array + sort + transpose?

I'm working on a dynamic dashboard in Google Sheets that uses response validation to choose an student's name from a drop-down, pulling the relevant information for that particular student and adjusting the graphs/charts. One of the sections of the dashboard shows a list of events and the dates they happened, in chronological order. The order of events changes based on the order the dates happened in, which are pulling from a separate sheet (called "Database"), meaning the order of the events changes for each student.
I'm trying to create a formula that will locate the row for the currently selected student in the Database sheet, create an array with the headers of the Database sheet (for the event names) and the one row that matches the selected student's name, put that array in order by chronological date, and then transposes it so that it's a list of events in one column and their date in the other column.
I've created a copy of the dashboard and removed/edited all student information. In the sheet called "Student Tracker", I'm working in cell J7 (colored purple). It needs to pull the dates for the selected student and the header row (to label the dates) from the sheet called "studentList".
Thanks in advance for any help you can provide!
try:
=QUERY(TRANSPOSE(QUERY(studentList!A:Q,
"select E,F,G,H,I,J,K,L,M,N,O,P,Q
where A ='"&C4&"'", 1)),
"select Col1,' ',Col2
where Col2 is not null
order by Col2 label ' '''", 0)
note that columns J and K are merged so one empty column needed to be included in outer QUERY

Resources