Search and return multiple rows in excel - excel

This is my problem. I have a spreadsheet containing alot of data. What I want to do is create a way that I can search for a recurring name, and return all the information (rows) associated to it. Here is a mini example below:
A B C D E F
ID Name Date Client ID Balance Owed
100 Tom 1/11/11 256 300 200
100 Tom 1/12/11 565 500 150
100 Tom
200 Jay
200 Jay
300 Frank
100 Tom
100 Tom
400 Ted
You get the idea (I hope). So what I want to do on another sheet is search for "Tom" and get it to return ALL instances of Tom in the Name column and return the data in the rows associated to Tom. So I would get back 5 results of Tom with all the necessary information. Thanks in advance!
B

Have you tried Pivot Table option found in the Excel, this might help you without any coding, if all you need is to find some duplicates

Could just apply a filter to the data and have the user select their name from column B. No need to copy data this way, so the update issue goes away. (probably best to delete the blank row below the heading row first)

Related

Google sheets formula to get the Top 5 List With Duplicates

I'm trying to compile a best 5 and worst 5 list. I have two rows, column B with the number score and column C with the name. I only want the list to include the name.
In my previous attempts the formula would get the top/bottom 5 but as soon as a duplicate score appeared the first known name with that value would just repeat.
Here is my data
26 Cal
55 John
55 Mike
100 Steve
26 Thomas
100 Jaden
100 Jack
95 Josh
87 Cole
75 Brett
I've managed to get the bottom 5 list formula correct. This formula works perfectly and includes all names of duplicate scores.
Example of what I get:
Cal
Thomas
John
Mike
Brett
=INDEX($C$56:$E$70,SMALL(IF($B$56:$B$70=SMALL($B$56:$B$70,ROWS(E$2:E2)),ROW($B$56:$B$70)-ROW($B$56)+1),SUM(IF($B$56:$B$70=SMALL($B$56:$B$70,
ROWS(E$2:E2)),1,0))-SUM(IF($B$56:$B$70<=SMALL($B$56:$B$70,ROWS(E$2:E2)),1,0))+ROWS(E$2:E2)))
Here is the formula I've tried to get the top 5 - however I keep getting an error.
=INDEX($C$56:$E$70,LARGE(IF($B$56:$B$70=LARGE($B$56:$B$70,ROWS(E$2:E2)),ROW($B$56:$B$70)-ROW($B$56)+1),SUM(IF($B$56:$B$70=LARGE($B$56:$B$70,
ROWS(E$2:E2)),1,0))-SUM(IF($B$56:$B$70<=LARGE($B$56:$B$70,ROWS(E$2:E2)),1,0))+ROWS(E$2:E2)))
Example of what I'm looking for
Steve
Jaden
Jack
Josh
Cole
You can set two queries like this for both cases:
=QUERY(B56:C70,"Select C order by B desc limit 5")
=QUERY(B56:C70,"Select C order by B limit 5")
Use SORTN() function like-
=SORTN(A1:B10,5,,1,1)
To keep only one column, wrap the SORTN() function with INDEX() and specify column number. Try-
=INDEX(SORTN(A1:B10,5,,1,1),,2)

Arranging a grade-table in a spreadsheet

I am giving a homework exercise that the student can submit in singles or pairs. The solutions are submitted in a Google form with three fields: submitter1, submitter2 (optional), solution. The submissions automatically go into a Google spreadsheet with four columns: submitter1, submitter2, solution, and grade (filled in by the TA). For example:
submitter1 submitter2 solution grade
111 222 x 100
333 y 90
444 555 z 80
I would like to create a second sheet that automatically lists the grades of each submitter alone, e.g:
submitter grade
111 100
222 100
333 90
444 80
555 80
The order in the second table is not important.
Is there a way to do this in Google spreadsheet?
Alternatively, is there a way to do this in another spreadsheet software, such as LibreOffice Calc or Excel? (in that case I could copy the spreadsheet to that program and do the calculations there, though it is less convenient than doing it directly in Google spreadsheet).
EDIT: The main problem is to collect all submitter IDs into a single column. I do not know in advance how many submissions there will be, and how many of them will be single/pair. I tried to put in the "submitter" column:
=IF(ISBLANK(Sheet1!A2),Sheet1!$B$2,Sheet1!A2)
and copy it downwards. This gives me all the first-submitters, and then the first second-submitter. But then how to automatically take the next second-submitters?
List the submitters with this in A2,
=ArrayFormula(UNIQUE(TRANSPOSE(SPLIT(CONCATENATE(Sheet1!A2:B&CHAR(9)),CHAR(9)))))
Retrieve their grades with this formula,
=index(Sheet1!D:D, iferror(match(A2, Sheet1!A:A, 0), match(A2, Sheet1!B:B, 0)))
Linked google-sheet here (updated)
=UNIQUE({{Sheet1!A:A,Sheet1!D:D};{Sheet1!B:B,Sheet1!D:D}})
Arrange arrays and do the formulas. QUERY to remove blanks, if needed:
=QUERY(UNIQUE({{Sheet1!A:A,Sheet1!D:D};{Sheet1!B:B,Sheet1!D:D}}),"Select Col1,Col2 Where Col1 is not null")

Multiple Vlookup for identifying a customers name or business

I want to create a multiple vlookup to match records on an ID from two sheets. If the column reference does not exist I want it to look at a different column.
This is what I have already:
=IF(VLOOKUP(A2,'Roots data'!F$2:Y$1139,18,0)>0,VLOOKUP(A2,'Roots data'!
F$2:Y$1139,17,0))
18 being the column which I want to check first and 17 being the column I want to check second. Can you please advise why this is not working appropriately?
Sample data:
Table 1:
ID First Name Last Name Age/Road
1 James John
2 John Miller
Table 2:
ID Age Address
1 21 1 Road
2 22 2 Road
In this example, if I wanted to find the Age of ID 1 which is James I would do a vlookup to identify this, if the age was not present I instead would want to know the address for ID 1, to be populated under Age/Road in Table 1.
I believe this is what you are looking for:
=IF((VLOOKUP(A2,'Roots data'!F$2:Y$1139,18,FALSE)=0),VLOOKUP(A2,'Roots data'!F$2:Y$1139,17,FALSE), VLOOKUP(A2,'Roots data'!F$2:Y$1139,18,FALSE))

Total points for each student in Google spreadsheet or excel

I am in the process of creating a Google form, which students will fill out after attending an event. Based on the event they attend, I will be assigning points to them and this form can be submitted through the whole year.
Is there a way to get a total number of points for each students, since they'll be submitting the form multiple times, I need a way to tally up the points for each students
Example spreadsheet goo.gl/1aunYg
Sam | 2
Jon | 2
Mike | 2
Don | 2
Sam | 3
Sam | 1
Jon | 2
Mike | 1
Total for Sam: ???
Total for Jon: ???
Total for Mike: ???
Total for Don: ???
In google spreadsheets, assuming you have the names in Col A and the scores in Col B, you can also try:
=query(A2:B; "select A, sum(B) where A <>'' group by A label sum(B) 'Totals' ")
This should output an array of unique names and the summed scores.
Sort the list on Name (Home>Sort & Filter)
Add a heading for the columns
Apply SubTotals (Data>Subtotal in the Outline group) at each change in Name and using the function Sum.
You can then hide/show individuals using the controls on the LH side.
Google Spreadsheet see SUMIF
In Excel you could do something like ...

Index/match with two criteria anyway to get the second set of data using unique identifiers?

I've been stuck for some time trying to match up two different data spread sheets. I'm trying to match off dollar amounts with matching names that correspond to the dollar amount. I went ahead and assigned unique identifiers to each row thinking that would help me match off the amounts, but my problem comes when there are two or more dollar amounts that are the same and have the same name.. is there anyway to get the second id to show up?
Formula sheet: (I need The second 112 to pull 113.. anyway thats possible??
A B C D E F G
IDSheett2 IDsheet1 NameSheet1 NameSheet2 Item AmountSheet1 AmountSheet2
554 112 Jim Jim Hat 25 25
555 112 Jim Jim Shoe 25 25
Formula in column B2: it should go through both sheet 1 and 2 and automacially fill in the matching id - id that matches the name and amount.
=IFERROR(INDEX(sheet1!$C$2:$C$1000,MATCH(1,INDEX((sheet1!$A$2:$A$1000=D1)*(sheet1!$B$2:$B$1000=G1),0,1),0)),"")
Data from Sheet2:
A= ID B= Name C= Item Name ( ID basically row 1 = 1, 2 = 2.. )
A B C D
554 Jim Hat 25
555 jim Shoe25
Data from Sheet1:
A= name B= amount C= assigned ID ( ID basically row 1 = 1, 2 = 2.. )
A B C
Jim 25 112
Jim 25 113
I'm also open to other ideas. Thanks for the help.
UPdated::: Based on comments
im not trying to create a database.. i have two sets of data that i'm trying to compare and match off like items(i take matched items and email it out to a group of people). i had to change some of the names because this is work related but the overall concept should remain.
it is Impossible for me to know how many names will be on incoming wires and how many names will be on my expected wires lists. I assigned unique ids per row on each page so i can do iferror/index/match to pull from a unique row to the main page.
What im trying to accomplish:
I have two sets of data: Sheet1 is incoming wires (it gives me a name and an amount) Sheet 2 is the account name, Item its for, and expected amount.
I'm trying to match the name and amount on the formula sheet but i run into the problem of two items with the same name and the same amount only pulling the first ID number it runs into and this becomes a problem because i have another vba code that will delete multiple ID's so i know i'm not counting something twice.
my final page should read:
ID sheet2 IDsheet1 Name Item(sheet2) Amount
554 112 JIM Hat 25
555 113 JIM Shoe 25
but right now the 113 id wont pull and it will just be 112 twice (which will end up getting deleted so i will miss that second match)
..+ everything works perfectly unless there are two items for the same name and the same amount +.. that is the only time i run into this problem.
Is there any code or process that can have the sheet realize that it has already used the ID of 112 once and then automatically fill in the id of 113 (so it won't get deleted by my vba code)?
In your formula sheet, B2 and copied down:
=IFERROR(INDEX(Sheet1!$C$2:$C$1000,MATCH(1,INDEX((Sheet1!$A$2:$A$1000=D2)*(Sheet1!$B$2:$B$1000=G2)*(COUNTIF(B$1:B1,Sheet1!$C$2:$C$1000)=0),),0)),"")

Resources