(Google Sheets/Google Forms) I'd like to be able to collect live data from different columns and have them populate one column instead - google-sheets

I'm collecting data from a Google Form that allows the user to choose which language they'd like the survey to be in, and based on his/her answer, the Google Form will utilize branching to lead them to the questions in the language he/she chose. For example, if they choose 'English,' a question they will answer is 'Full Name,' while if they choose 'Español,' they will answer 'Nombre y apellido.'
This leads the spreadsheet to collect the data from those questions into two separate columns. Is there a way to set up the spreadsheet so it organizes the data from the same translated questions into columns? The form will be receiving data constantly. I've tried stacking the columns using this formula template: ={A2:A5;D2:D5}, but the formula simply moved cells whenever data was added from the Google Form. I am collecting multiple points of data in 6 different languages, and I'm really hoping there's a way to organize this data to make it much less cumbersome to wade through.
If you have any ideas, please let me know! I'll try whatever you've got. 😅 Thanks!

You can union the column values, using open ranges, and then filter out the empty values using =QUERY() or =FILTER().
This way you'll be effectively joining values from different columns as one.
For example if you wanted to join data of columns A, D and E, you could do:
Using QUERY
=QUERY({A2:A;D2:D;E2:E}, "select Col1 where Col1 is not null")
Using FILTER
=FILTER({A2:A;B2:B;E2:E}, {A2:A;B2:B;E2:E} <> "")

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).

Google Sheets Count Unique Dates based upon a criteria in different columns

I am trying to find a formula that will give me the count of unique dates a persons' name appears in one of two different columns and/or both columns.
I have a set of data where a person's name may show up in a "driver" column or a "helper" column, multiple times over the course of one day. Throughout the day some drivers might also be helpers and some days a driver may come in for duty but only as a helper. Basically all drivers can be helpers, but not all helpers can be drivers.
I've attached a link to a sample sheet for more clarity.
https://docs.google.com/spreadsheets/d/1GqNa1hrViX4B6mkL3wWcqEsy87gmdw77DhkhIaswLyI/edit?usp=sharing
I've created a REPORTS tab with a SORT(UNIQUE(FLATTEN)) Formula to give me a list of the names that appear in the DATA Tab.
I'm looking for a way to count the unique dates a name from the name (Column A of the REPORTS Tab) appears in either of the two columns (Column B and/or C of the DATA Tab) to determine the total number of days worked so I can calculate the total number of days off over the range queried.
I've tried several iterations of countif, countunique, and countuniqueifs but cannot seem to find a way to return the correct values.
Any advice on how to make this work would be appreciated.
I think if you put this formula in cell b7 you'll be set. You can drag it down.
=Counta(Unique(filter(DATA!A:A,(DATA!C:C=A7)+(DATA!B:B=A7))))
Here's a working version of your file.
For anyone interested, Google Sheets' Filter function differs slightly from Excel's Filter function because Sheets attempts to make it easier for users to apply multiple conditions by simply separating each parameter with a comma. Example: =filter(A:A,A:A<>"",B:B<>"bad result") will provide different results between the Sheets and Excel.
Excel Filter requires users to specify multiple conditions within parenthesis and denote each criterion be flagged with an OR condition with a + else an AND condition with a multiplication sign *. While this can appear daunting and bizarre to multiply arrays that have text in it, it allows for more flexibility.
To Google's credit, if one follows the required Excel Syntax (as I did in this answer) then the functions will behave the same.
delete what you got and use:
=QUERY(QUERY(UNIQUE({DATA!A:B; DATA!A:A, DATA!C:C}),
"select Col2,count(Col1),"&D2&"-count(Col2)
where Col2 is not null
group by Col2"),
"offset 1", 0)

Google Sheets: How to Filter Vertically Merged Cells

I've come looking for help regarding this issue. I'm a teacher, and am trying to help my students get all their documents together for university applications. Google Sheets tell me that I'm not able to filter cells containing vertical merges, but I want to filter by the earliest application deadline (column G) so I know which student I have to chase up first, second, third, etc., without losing the rest of the data in the row.
Does anyone know a good way of doing this? I've created a sample of my spreadsheet: here.
Thanks in advance.
Try Insert > New sheet and this formula in cell A1 of the new sheet:
=query('2021'!A1:Z, "where G is not null order by G", 1)
The sorted list is for reference only. You will need to continue to do your editing in the 2021 sheet.
I would split the data between a couple of sheets.
In the first sheet you'd have important data that can be seen at a glance and filtered easily, like student names, universities and deadlines.
In the second sheet (which you can link by student name or id) you can put extra info like necessary documents, urls etc - something like this.
Alternatively keep all the info in one sheet but don't use split columns or rows - it isn't conducive for sorting, filtering and viewing data (and what's the point of data if you can't analyse it?)

Simple frequency distribution chart or formula (Google Sheets)

Have used this forum to help solve a few spreadsheet issues in the past (so many thank for all the donated time and expertise).
Hoping the community can help with something that thought initially to be quite simple but I can't find the answer or solution anywhere.
I have a list of values and I want to create a frequency distribution list from this. I don't want to collect the data into ranges (i.e. histogram style) but I do need to know exactly how many instances there are of each value. Values in spreadsheet example below.
https://docs.google.com/spreadsheets/d/10gkP4DLA_k8yrbVdNEFmrDwKrg-B_t6BUkAmPNE2CpQ/edit#gid=0
I don't need the data presented in a graph but if a graph is the easiest way to collate this then that's fine as I will need to routinely do this calculation.
Many thanks.
db
A 'group by' query should do this:
=query(B3:B,"select B,count(B) where B is not null group by B label B 'Value'")

Reorganizing Google Sheets data dynamically

I'm currently working with Google Sheets to import data from Contact Form 7 in Wordpress. All the data is coming over fine, but I wanted to see about formatting it in more user friendly fashion. I've simplified the example a bit, but the gist of the form I have created allows the user to request multiple versions of a graphic file with different wording as needed, up to 5(my example has just 2 for simplicity sake).
All the data is imported using the CF7 variables and ideally I wanted to clean this up a bit. What I had thought of as a solution was creating a second sheet that pulls in this data submitted in the first sheet into a more user friendly format, as I intended to use this as a work form for a designer to create the requested graphic once the data is received. With each request the name/department/email/date all stay the same, but I'd like to display the version and line 1 and 2 data on another line. Is it possible to reorganize data like this on the fly, so when a new form is submitted and adds data to sheet 1, sheet 2 would then update with the properly formatted info?
Is this even possible to do? I did some looking online, but didn't anything that really related to this type of data manipulation.
Solution:
Here's what ended up working for my example
=ArrayFormula(QUERY({
Sheet1!A2:D,Sheet1!E2:G,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!H2:J,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!K2:M,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!N2:P,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!Q2:S,ROW(Sheet1!A2:A)
},"select Col1,Col2,Col3,Col4,Col5,Col6,Col7 where Col5<>'' order by Col8",1))
Yes, it's possible.
One way is to use arrays and the QUERY function.
For simplicity, let say that
Columns A and B have the general information of the order
Columns C and D have the data for version 1
Columns E and F have the data for version 2
Columns G and H have the data for version 3
On the output sheet, add the headers.
Below of them add a formula like the following:
=ArrayFormula(QUERY({A2:B,C2:D,ROW(A2:A);IFERROR(LEN(A2:B)/0),E2:F,ROW(A2:A);IFERROR(LEN(A2:B)/0),G2:H,ROW(A2:A)},"select Col1,Col2,Col3,Col4 where Col3<>'' order by Col5"))
References start on row 2 to skip the headers to avoid to include them on the output sheet.
ROW(A2:A) is used to keep the order
IFERROR(LEN(A2:B)/0) is a "trick" used to "hide" the order (general information) data for the second and following rows for the same order. On the select parameter of the QUERY function, it's referrey as Col5 on the order by clause.
It's assumed that lookup-choice-1 will never be empty.
NOTES:
If more columns were added, the column numbers should be updated accordingly
Don't use the order by clause to sort the result by the general information columns because the "trick" to hide the "labels". If you need to apply a sort, do it' before applying the above formula, you could do this by sorting the source range through the Data > Sort range... feature, so the data is sorted before it's transformed by the above formula.
See also
Sort and filter your data, an official help article describing Data > Sort range...

Resources