Excel help: check two columns for matching row, copy in new data - excel-2010

I have two excel data sources I need to combine into a single list. I'm sure this question has been asked in a different way but I couldn't get any of the suggested formulas I found in my searching to work for me!
At the moment, each list sits on a separate tab and is organised as below
Table 1
| Account | Amount | reference| NEW REFERENCE |
Table 2
| NEW REFERENCE | Reference | Amount |
What I want to do is, where Reference and amount values match on a line, pull the NEW Reference into the first table from the 2nd.
The items are in a different order.
There are instances where there are duplicates in the 'reference' column, but these are differentiated the by the values in the Amount column and vice versa.
Where two rows match based on both of these columns, Ideally I'd like to highlight these but could live without it.

I have 2016 so I am not positive on what the tabs/functions are called exactly for 2010:
You should have either a data or reference tab. Select all of the columns of data. On one of your excel sheets/workbooks, click the "From Table/Range" button (should be within the get & transform data section).
Once the query editor opens, you will need to add a new source (the second excel worksheet you want to join to this one); select file > Excel.
Once you have selected that source, you will need to merge the two queries together using whichever join method is appropriate.

Related

Google Sheets: Many to Many Table Join

I am trying to create a sheet to determine the amount of overlapping hours for employees.
I have one table with timeclock data for the Employees.
Table 1
And another with timeclock data for their Support Staff.
Table 2
This is the desired output. Each row from table A has all the date matches from table B. From here I would compute the number of overlapping hours in the final column and then roll that up into another sheet.
Table 3, Desired Output
(apologies for image links, I can't post inline images yet)
Sample sheet here Please let me know if you have any ideas for me!
I know its a combination of QUERY, ARRAYFORMULA, FILTER and more but I just can't find the right combo.
Here's a way of doing this type of join using only built-in functions:
=arrayformula(lambda(employee,support,
lambda(datecomp,
lambda(rows,
{vlookup(index(rows,,1),{row(employee),employee},sequence(1,columns(employee),2),false),
vlookup(index(rows,,2),{row(support),support},sequence(1,columns(support),2),false)})(
split(filter(datecomp,datecomp<>""),"|")))(
flatten(if(index(employee,,1)=transpose(index(support,,1)),row(employee)&"|"&transpose(row(support)),))))(
Employee!A1:D6,Support!A1:E5))
There's a lot going on here, but the basic idea is that we are comparing the date columns of each table against each other in a 2D IF array, and where the dates match we are obtaining the row index of each table. After some manipulations we can use these row indexes on each table in two side-by-side VLOOKUPs to obtain the joined table.
DMac,
I wrote myself a QUERY replacement custom function that uses real SQL select syntax.
For your data it looks something like (You need a tab called employee and a tab called support for this to work) :
=gsSQL("select * from employee full join support on employee.date = support.date")
See my test worksheet: (line 164 on gsSqlTest sheet)
https://docs.google.com/spreadsheets/d/1Zmyk7a7u0xvICrxen-c0CdpssrLTkHwYx6XL00Tb1ws/edit?usp=sharing
You need to add one Apps Script file to your sheet to give you the custom function:
https://github.com/demmings/gsSQL/blob/main/dist/gssql.js
For more help using more features see:
https://github.com/demmings/gsSQL
For example, changing the column titles, it would be like:
select employee.name as name .... (rest of your select).

IMPORTRANGE + extra column does not behave as table

I am creating a sheet for our homebrew RPG.
I'm importing a range of data (spell list) in the character sheet, via IMPORTRANGE.
I'm using a True/False checkbox to add the line to a table in another sheet.
=IFERROR(QUERY(DataSorts!$A$3:$Q$1001;"select " &IF($E$15;"C";"B")& " where (A=TRUE)");"")
I want to use the imported datas as a table WITH the checkboxes column, so my players could filter or classify their data. The checkboxes need not to be on the original spell list so any player could have their own selected ones.
I need to Import the data as the original spell list is expanding and I need to update it regularly.
However, if I update my original sheet comporting the speel list, any add or substract of row will break the checkbox usage (because they wont move where the imported data will, thus the spells selected won't stay the same).
How can I link these 2 parameters ?
Use an index to keep the order in the imported data SS, and then perform the combined VLOOKUP+IMPORTRANGE.

Google sheets: Filter sheet so it shows or selects only columns containing string

I have a google sheet with many columns, and I want to select (or filter) all of the columns whose labels contain the string "xyz" in them. Is there any simple way to do this?
The only way I've been able to do this so far is by Cmd + F to search the sheet for "xyz" and then manually select all of the columns with my mouse.
Context: The data is from a survey where participants evaluated 10 products. For each product, they answered the same set of questions. The way the data reads out to a sheet, each question gets a column. So that means there are 10 columns, for example, where I'm asking "how likely would you buy this product?" I want to select all 10 columns that ask how likely they would buy x product so that I can copy these columns, paste them into a new tab, and analyze them. These 10 columns all contain in their labels the string "how_likely", so I'm trying to select these columns by somehow searching for all columns that contain that string.
You can achieve this by doing a couple of preparation steps as follows:
Create a sheet where you list the unique part of the question title (eg. "how_appropriate" , etc.). I named it "QuestionsList" and it looks like this:
Create a sheet where you transpose the data in "FormData". I called this sheet "TransposedFormData" and it looks like this:
Use =TRANSPOSE(FormData!A1:H16) in cell A2 for it. I wrote the header names for easier visualization, but they aren't required.
Now that you have the data prepared, lets get the desired output.
In the sheet "DesiredOutput" in cell A1, write the following formula:
=Transpose(QUERY(TransposedFormData!A:P,"select * where A contains '"&QuestionsList!A1&"'",0))
Notice the desired output: corresponds to only one question (the one listed in QuestionsList!A1). So you will need a "DesiredOutput" sheet for each of the question titles, and on each change the row number in QuestionsList!A* where "*" represents the row number of the question title you want.

When using QUERY, how can I make it so that data moves together when using filter?

I am creating a tool for a video game I play.
Link to the example spreadsheet (Please make a copy to edit so that this copy stays intact for additional helpers).
Sheet 1 is “Choose Owned”. It contains a list of all of the champions available in the game and includes their attributes.
Column A contains checkboxes. Checking a checkbox indicates that the user owns that champion, and brings it to Sheet 2.
Sheet 2 is called “Owned”. It contains a list of the champions checked off in “Choose Owned” (aka the champions the user owns). “Owned” includes the champion attributes too, as first seen in “Choose Owned”.
Beyond those same attributes, “Owned” contains 8 additional columns.
These columns are from Columns G:N and are labeled ‘Level’, ‘Rank’,
‘Ascension Lvl’, and ‘Team Label(s)’ (‘Team Label(s)’ takes up
columns J:N). This data is all unique information and requires the
user to input the information themselves depending on their
champions.
Because there are so many champions, I want the user to be able to use the Filter function in “Owned” so they can easily locate the champion they need or sort the table however they wish.
However, because I use the QUERY function to get the data from “Choose Owned”, the Filter function tends to break. The most obvious error comes when you try to sort A-Z or Z-A; this simply cannot be done. I was fine with this, and have even included a note at the top telling the user to avoid sorting alphabetically.
Everything else works correctly until the user tries to add a new champion from “Choose Owned”. When the champion is added to “Owned”, the additional, unique data in columns G:N go out of order because they don’t move with their original champions.
Example:
I choose my champions. These champions are copied to “Owned”.
I pick their relative data in columns G:N.
A few days later, I obtain new champions and check them off in “Choose Owned” so they are added to “Owned”. However, when I do this, the champions stay in the same order as they are in “Choose Owned”, and columns G:N do not move with their champions so now, that information is with the wrong champion.
I want the additional data (G:N) to move with their champions when the table is edited due to champions being added. Or, in other words, I want those columns to stay linked to the first columns.
If there is a different way to achieve all of this like if I have to use a function other than QUERY, that is fine!
Please share any solutions you may have. I would prefer to not use a script but will consider the idea if it works.
this is a common issue within Google Sheets and it's solvable in 2 ways:
either by introducing a common value (unique ID) and then linking the manual input to query and aligning it by ID
or easier approach in your case - using timestamp/linear ID so every new entry would be added to the bottom and then the query would be sorted based on this order.

Display columns of information in Google Sheets based on Drop down selection

What I am looking to do is have a list of items in a dropdown list in cell A1. Lets say the list is "Presidents, Movie Stars, Rappers".
When I select Presidents I want Column B in Sheet 1 to list all the presidents with column C listing their party they represented and column D to list their years in office. When I select Movie stars I want column B to List various Movie Star names, Column C to list number of movies starred in and Column D to display their highest paid film.
So in short I want 1 dropdown to populate 3 columns worth of data.
Everything I have looked up uses scripts(which I think this is completely doable without using) uses VLOOKUP but has 1 cell worth of data appear(ex, A1 dropdown displays data in A2 but not data in B1:B50, C1:C50, and D1:D50) or doesnt worth with multiple columns of data. I am fine if the data pulls from another sheet I just think there is a better way to do this then filling in 200+ cells with an if:then function based on my selection in cell A1. Anyone know an easy way to do this?
An elegant solution, in my opinion, is to do something like the following:
Create a column (which you can later hide) that has all value combinations, with a delimiter between the values. For example, you could have "Presidents>Barack Obama>Democrat>2008-2016"
Then create a simple function (no VLOOKUP needed!) to pull the individual values by using FIND to findn the location of the delimiters and split the combination.

Resources