Scan COLUMN for key set of initials, get value of that ROW, then get CONTENTS of different CELLS - google-apps-script

I have access to a review sheet, regarding the review of web content articles for blogs. I'm one of the reviewers.
Here's an image of the review sheet (I'm sorry, I haven't been granted access to embed images):
EXAMPLE REVIEW SHEET
I want to produce in invoice based on that review sheet. Here's the invoice:
EXAMPLE INVOICE
I understand how to create the link between the two separate spreadsheets, but what I need is this:
In the EXAMPLE REVIEW SHEET I need to look down COLUMN B (INITIALS) for the last instance only of initials 'MF' and make a note of the ROW
Then, I need to scan back up COLUMN B, for 3 more instances of MF, and make a note of the ROWS for all 3 instances.
I now have the last four instances of MF, and the ROWS they appear.
Now in my EXAMPLE INVOICE, I want to populate cells B19-22 with the contents of cells Aw Ax Ay and Az from the EXAMPLE REVIEW SHEET, where w, x, y and z are the 4 ROW NUMBERS that we got from the original LOOKUP.
Here's the link to the actual sheets (all on one spreadsheet for the examples)
ACTUAL SHEETS
For some other invoicing requirements, I found this line of code:
=index(B:B,max(row(B:B)*(B:B<>"")))
Which I know returns the lowest-positioned non-empty cell in a column. But I don't really understand WHY it returns it, I just know that it does. I'm sure some part of the INDEX function can help to return the values I need, but I don't know how.
I'm guessing that what I'm looking for is beyond the fx input on the spreadsheet, and requires a script to be run. Whereas I can sometimes make sense of some basic programming - and by that I mean ANSI 74 BASIC, which is where my knowledge stops - I can't really program using the script editor.
What I'd LOVE is if someone could help me, and also explain the logic behind the solution. I'll probably need it in layman's terms, but I'd really like to start understanding how to manipulate spreadsheets - so I'm really keen to find out HOW something like the INDEX code works, and what the variables mean.
I've tried to fathom the explanations given by Google but, TBH, their way of explaining seems to require that you understand their solution before they explain it to you. The examples are very hard to relate to the formulae, because the description of the variables is not 'human' enough.
If anyone fancies a stab at my problem, and could take the time to explain the logic behind the solution, please know that I'll be forever thankful!
Regards,
Miles

I think this formula will work for you, but unfortunately it's a bit more sophisticated than would make it easy to understand. I placed it in P19 on the Invoice tab.
There are a few different ways to solve your problem, but i wouldn't use INDEX() for any of them.
=ARRAYFORMULA(QUERY({'EXAMPLE REVIEW SHEET'!A2:B,ROW('EXAMPLE REVIEW SHEET'!A2:B)},"select Col1 where Col2='MF' order by Col3 limit 4"))
If you were willing to have a numbering column to the left of the table in the "Review Sheet" it would make all of this much simpler and I could show you how to do it in a way that might make a bit more sense.

Thanks for answering so quickly!
The REVIEW SHEET is maintained by somebody else, but I have editing rights as I need to fill in my review comments. I was planning to keep a linked copy of REVIEW SHEET as a tab in my Work Spreadsheet. If I do this, then there's no problem with adding a numbering column, or any extra columns that you think will help.
Thanks again
Miles

Related

How do I use VLOOKUP to fill out an hourly calendar schedule?

Rather than typing out the function I am dealing with since it is rather long and arbitrary without the columns it is referencing, I have provided a simplified mock-up of my spreadsheet here. Be sure to make a copy of it and not edit the original directly. If I need to remove this link, I will.
Essentially, I am trying to take a schedule that another party has already created and display it in an hourly calendar view according to the VLOOKUP search key. In my example linked above, I have created a classroom schedule in the Master Schedule tab that includes the room(s), subject, teacher(s), and start and end times, as well as the date. I have rooms scheduled for the current day, as well as the day before since some of the end times from the previous day go past midnight, and therefore I would like to include them in the calendar view for the current day if they run into the early morning. In that same tab, I have a VLOOKUP formula with the room number as the search key. The reason the formula is so long is because I have to account for if there are multiple rooms separated by a comma "," or forward slash "/", and it was drawn from an solution offered to another Stack Overflow question of mine. It gets the job done, but if there is a method that is not as convoluted, I'm all ears.
I would like to translate the data in the Master Schedule tab into the calendar view in the Room Schedule tab. I thought I had it worked out logically with a few IF statements, but I have struggled mightily. I realize open-ended questions like these aren't always appreciated on this platform, yet I am at a loss for how to accomplish what I am going for, especially without having the formulas take a long time to populate the calendar any time there is an update to the master schedule, so any help or a nudge in the right direction is greatly appreciated. I'm happy to clarify anything if the spreadsheet I linked or my objective is not clear.
paste in C2 cell and dra down and then to the right:
=IFERROR(FILTER('Master Schedule'!$F$2:$F&CHAR(10)&'Master Schedule'!$D$2:$D,
REGEXMATCH('Master Schedule'!$E$2:$E, "^"&$A2&"$"),
HOUR('Master Schedule'!$B$2:$B)<=HOUR(INDEX(SPLIT(C$1, "-"), 1, 1)),
HOUR('Master Schedule'!$C$2:$C)>=HOUR(INDEX(SPLIT(C$1, "-"), 1, 1)),
'Master Schedule'!$A$2:$A=TODAY()))
note: if this would be turned into one-cell arrayformula the performance of the sheet would suffer a lot hence this per-cell solution

How to select rows in google sheets by condition

I've been researching this for a couple of hours now and have had no luck.
I am trying to search for emails in my spreadsheet that contain "#google.com" and have them all selected so that I can copy them instead of going through them 1 by 1. There are around 90K so this would be a considerable undertaking.
This is the formula that I am currently using:
=QUERY(Data!A:A,"select A where(A =#google.com)")
All of the data is in column A.
Hope I've just made a dumb error somewhere.
Thanks in advance :)
Perhaps what you might try is:
=QUERY(Data!A:A,"where A contains '#google.com'")

google sheets query first row mess

I am designing a workflow at work to streamline some tasks. I get some CSV from a database which I want automatically added to a Google Sheet. I stored it on a Google Drive, got the direct download link and used it with IMPORTDATA on sheet1. So far so good.
The final aim is to create a good way to visualize which rows meet specific conditions, so I thought using a PivotTable might be handy. However, to filter out some of the uninteresting rows, PivotTables are not the way to go, since the filters are quite poor (no possibility of basic filter criteria like =, !=, <, >, etc). So I thought about populating a second sheet with a Query function (with the filtering statements) so that the PivotTable generates a report directly from a filtered source.
The issue (apart from the lag) is that sheet 2 (the one with the query) shows a strange output: the first row, that should contain only the column labels, mixes up the column labels with the value of the cell below them. It is quite baffling. Moreso because it does not happen all along row 1, but it only appears to do so on the first seven columns. So insted of A1 showing "event_id", it actually shows "event_id 106727", which is the value of the fisrt event that should go on A2.
Any thought why this happens?I already checked and there does not seem to be anything wrong with the CSV.
If yyou also have a suggestion of why this whole setup would be a bad idea, please also tell me :P
Thank you!
The query command combines multiple header rows into one. And sometimes it mistakes your data for headers. To avoid this, use the optional third parameter to specify the number of header rows:
=query(range, query_string, 1)
(if there is one header row).
The approach by #user6655984 did not work for me, because I was already using the third parameter to customise my header usage.
What occurred was that I was performing 12 queries to different sheets with similarly data. One column was a mixture of strings, such as "12 FPS", "14fps", and numbers. When I began working my way through these columns on all the sheets, I was left with mostly numbers, with a few strings spread throughout.
This caused my query to create a massive first row which concatenated the results of about 6 rows together, cell by cell, before showing the rest of the results, where in this column I edited, all the strings had been removed.
By happenstance I saw this one person here who talked about fixing a query issue by making sure that they type-converted the information in a column to be consistent.
This led me to find the following Google support forum post, about queries and data types, from 2019: Query function not working with specific data set (but working with others)
Giving this a go, I tried turning all the data in all the columns that were equivalent to each other in each sheet I was querying into numbers fixed the issue. Try this if setting headers is not working; make sure you don't have silent type errors.

Grade multiple forms on one spreadsheet

I need to grade some google forms. Due to the way I needed it to work, I used one form for every question on the'quiz'. Not every person will have taken the same question. The responses are recorded into spreadsheets, but google makes each form have it's on sheet on the same document. So, because of the random questions, it make's it harder to grade. Some users may have all taken question 1, while only a couple have taken question 2. The names won't be in order, either, if they took the quiz at different times. So how can I grade this? There's about 40 questions total. I'm thinking I'll need to use google app script, but I'm not sure how.
Spreadsheet
This shouldn't be to hard to do but might be a bit complicated to explain here...
What I would do :
get all data from each page into an array
add the question and the right answer in front of every user answer for each array row (page)
concatenate all the arrays into one global array
sort it on user Name and get a new array for each and every user
sort all these arrays on question (it would probably be nice to add numbers to these question if you want to control the order of the questions)
evaluate the user answers (easy since you have both the right answer and the user's answer in each row)
write back to a spreadsheet, eventually one sheet / user
Nothing really hard to do but a lot of work though ;-)
Good luck

Get a list of valuesd based on lookup selection in Google Spreadsheets

Hm. It's hard for me to write what I would like to accomplish.
I would like to make gamereport in Google spreadsheet for our Hockey Tournament. I would like to have all players attending our tournament in one sheet. Name, Number and Club. On game report sheet I would want to choose a club from a dropdown menu, and players would be inserted upon this query as a list.
Is it possible to do something like this in google spreadsheets?
Further more, I would like to have a sum of all goals and assist on players sheet.
Till now we have made this all by hand in Excel. Is it possible to have one sheet just for all the players? So If something changes I can change it only in one place?
You can try to help me. I have made one sheetpublic:
https://docs.google.com/spreadsheet/ccc?key=0ArUVg6g8Zlp-dFFpdEYzN1BSSjBnMmhfREdxbDczRHc&usp=sharing
Please help me make this? Any guidelines would be more than welcome. I know I should give this some to make it for money, but we can not afford it. We barely cope to get the season trough.
I would be more than grateful if you can help me.
Regards
Gregor
One of the items you are looking for is the filter function.
I've created a similar spreadsheet here:
https://docs.google.com/spreadsheets/d/1tE80u93n3SLiXmiBSQ5tc65wFHw6xVoQVHZlKEYQpqs/edit?usp=sharing
in A9 you'd want to add something similar to
=filter(Players!A2:D100,Players!E2:E100=A7)
You'd also want to ensure the range you are filtering is in a similar format to the location it is going to (i.e. merged cells).
Now the spreadsheet will adjust the players based on the team selected in the drop down.
Hope this helps.