Convert every 2nd & 3rd row into a column - google-sheets

I have a long list which of a persons name, job title and company. The problem is it's in one long list e.g.
Joe Smith
Director
Google
Sam Jones
Marketer
Facebook
Etc
Which makes it very difficult to read. Can I convert this so I end up with a table with first name, job title and company all on separate columns?

try:
=QUERY({QUERY(A1:A20, "skipping 3", ),
QUERY(A2:A21, "skipping 3", ),
QUERY(A3:A22, "skipping 3", )}, "where Col1 is not null")

Related

Sorting information in Google Sheets

I have some information in Google Sheets in the following format:
Authors
Number
Akwaeke Emezi
2
Ezra Claytan Daniels, Ben Passmore
3
Nick Tapalansky, Kate Glasheen
9
John Allison, Lissa Treiman, Whitney Cogar
1
John Allison, Lissa Treiman, Max Sarin, Whitney Cogar
2
Gene Luen Yang, Sonny Liew
43
Gene Luen Yang
9
I would like to have a second sheet that does the following:
Generate a list of each individual author in "Authors" (ideally in alphabetical order by last name)
Calculate the average Number associated with each author (e.g. Akwaeke Emezi would be 2 and Gene Luen Yang would be (43+9)/2)
I can do this as a one-off calculation, but what I'm really looking for is a way to set this up such that when I add more entries to the spreadsheet (where the new entries will contain a combination of new authors and authors that already appear in the list), this second sheet will automatically update the list of individual authors and their associated average numbers.
try:
=ARRAYFORMULA(QUERY(QUERY(SPLIT(FLATTEN(REGEXEXTRACT(
SPLIT(A2:A, ","), " (.*)$")&"×"&TRIM(SPLIT(A2:A, ","))&"×"&B2:B), "×"),
"select Col1,Col2,sum(Col3)/count(Col2) where Col3>0 group by Col1,Col2"),
"select Col2,Col3 offset 1", 0))
or:
=ARRAYFORMULA(QUERY(QUERY(SPLIT(FLATTEN(REGEXEXTRACT(
SPLIT(A2:A, ","), " (\w+)$")&"×"&TRIM(SPLIT(A2:A, ","))&"×"&B2:B), "×"),
"select Col1,Col2,sum(Col3)/count(Col2) where Col3>0 group by Col1,Col2"),
"select Col2,Col3 offset 1", 0))
update:
=ARRAYFORMULA(QUERY(QUERY(SPLIT(FLATTEN(REGEXEXTRACT(
TRIM(SPLIT(REGEXREPLACE(A2:A,
"\b(?:X)?(?:X)?(?:X)?(?:V)?(?:I)?(?:I)?(?:I)?(?:V)?(?:X)?(?:X)?(?:X)?\b", ), ",")),
" (\w+)$")&"×"&TRIM(SPLIT(A2:A, ","))&"×"&B2:B), "×"),
"select Col1,Col2,sum(Col3)/count(Col2) where Col3>0 group by Col1,Col2"),
"select Col2,Col3 offset 1", 0))

Marking employees' names if detecting their time of working shifts are too close

I am designing a formula to warn the time of work shifts of the same employee conflicting. Based on the working schedule on A row to arrange the work shifts of every employee. The general working time is 3 hours. For an example of a picture, Andy in the table has arranged a shift at 2021/10/23 22:00, however, accidentally arranges andy works again at 2021/10/24 01:45, and his previous three hours work times have not been completed, which conflicts, so I hope to design that when his name is marked in the B row, it will be marked as a reminder. According to the picture, I originally designed an index and Match function in the D row to catch The names of employees with conflicting working hours are distinguished by V and X, but it seems that this group of functions cannot be successful. I would like to ask if there is a correct solution to solve it, thank you for your assistance.
add helper column:
=INDEX(IF(B:B="",,REGEXMATCH(B:B&COUNTIFS(B:B, B:B, ROW(B:B), "<="&ROW(B:B)),
TEXTJOIN("|", 1, "×", IF(0.125>IFNA(ABS(QUERY(
TRANSPOSE(SPLIT(FLATTEN(QUERY(QUERY(QUERY({1*A:A, B:B},
"select max(Col1) where Col2 is not null group by Col1 pivot Col2"),
"offset 1", ),,9^9)), " ")), "offset 1", )-
TRANSPOSE(SPLIT(FLATTEN(QUERY(QUERY(QUERY({1*A:A, B:B},
"select max(Col1) where Col2 is not null group by Col1 pivot Col2"),
"offset 1", ),,9^9)), " "))), 99), TRANSPOSE(SORT(UNIQUE(B:B)))&ROW(A:A)+1, )))))
you can change ranges to fit your needs just dont change last ROW(A:A)+1

Use COL name to Get ROW names based on whether a value exists in a Column with the specified Name

Would deeply appreciate it if anyone could help me with this.
Overview
In a google sheet I have the following grid:
School A
School B
School C
Tim
x
x
John
Martin
x
x
Jack
x
The Rows are Names of people who cater to certain schools. The value 'x' in the cell simply signifies the relation. So Tim caters to School A & School C and similarly Jack only caters to School C.
Note: The cells are either empty or contain that 'x'. Thought that might help. We don't really need to look for 'x' just a non-empty cell.
Question
I have another table like follows, where I have a School column listing all the schools in rows. I would like to create a formula to use the table above and return a concatenated string listing all the people catering to that school.
School
People
School A
Tim, Martin
School B
Martin
School C
Tim, Jack
use:
=INDEX(REGEXREPLACE(TRIM(SPLIT(FLATTEN(QUERY(TRANSPOSE(QUERY(QUERY(SPLIT(FLATTEN(
IF(B2:D="",,B1:D1&"♠♦"&A2:A&",♦"&A2:A)), "♦"),
"select Col1,max(Col2) where Col2 is not nUll group by Col1 pivot Col3"),
"offset 1", 0)),,9^9)), "♠")), ",$", ))
or:
=INDEX(REGEXREPLACE(TRIM(SPLIT(FLATTEN(QUERY(
{B1:D1&"♦"; IF(B2:D="",,A2:A&",")},,9^9)), "♦")), ",$", ))

Search if a cell contains different types of strings and output a string according to that

I use a google form to get responses from students, and the form is linked to my spreadsheet. I have another tab where I try to process all the data, and the first column is about the students' class and what their major is. So some of them wrote M1, M2 or Master 1. Some younger students wrote Licence 1, or L1, L2 (For the ones doing their bachelor, I'm in France)
So what I want to do is to get the strings in a specific cell, check if they are either "M1", "M2", "Master", "Licence" or whatever, and output a string "Master" or "Licence" (For Bachelor)
=QUERY(ARRAYFORMULA(REGEXREPLACE(REGEXREPLACE({A:A,PROPER(B:B)},
"M1|M2|Master 1", "Master"),
"L1|L2|L3", "Licence")),
"where Col2 contains 'Master'
or Col2 contains 'Licence'")
French syntax:
=QUERY(ARRAYFORMULA(REGEXREPLACE(REGEXREPLACE({A:A\PROPER(B:B)};
"M1|M2|Master 1|Master 2"; "Master");
"L1|L2|L3|Licence 1|Licence 2|Licence 3"; "Licence"));
"where Col2 contains 'Master'
or Col2 contains 'Licence'")

How to find next available date inline

I have this demo sheet
https://docs.google.com/spreadsheets/d/1iexvfvQVHUc8BooAxpDg8awf6CDpv80b6Z_etBNPc0M/edit?usp=sharing
What I need is an arrayformula is to find inline the next available date from Col "C" and Col "D" dates, and apply colors depending on it
Also, want to have a "Past" in the dates already past
I have in Col F my expected result, cuz is hard to explain exactly what I need
Any help please.
=ARRAYFORMULA(QUERY({IFERROR(QUERY(IF(LEN(C2:C),
IF((C2:C<TODAY())*(D2:D<TODAY()), "Past",
IF((C2:C<TODAY())*(D2:D>TODAY()), "On Going now", )), ),
"where Col1='Past' or Col1='On Going now'"),"");
QUERY(IF(LEN(C2:C),
IF((C2:C>TODAY())*(D2:D>TODAY()), "Next Available", ), ),
"where Col1='Next Available' limit 1")},
"where Col1 is not null"))

Resources