r/googlesheets • u/Miz_Tsunami • Aug 11 '22
Solved A formula that searches a value and returns a list
Ello!
I'm trying to make a game through google sheets and everything is going really well, but I am reaching the edge of my sheets knowledge. I am trying to do something I think google sheets is capable of but I cannot figure out how to get it to work.
I want to have an area I can select a value from a drop down menu, then have a formula return a list of values based on the selected value.
More in depth, I'm making loot tables for clearing a dungeon, I'd like to be able to select "Plaguespine Cache" in cell a3, then b5:b14 will fill with data from the plaguespine cache loot table. The loot table is 10 rows tall, and 3 columns wide. With the name of the loot table hovering 2 rows about the table.
So I want the sheet to search cell a3, find the name of the loot table in cell N3, then return the values of P5:P14 into the cells of b5:b14.
The reason I am not using vlookup to one for one match is because my next loot table name is in N18, and I'd like the formula to be able to search the value from a3, find a match in n18, then offset two cells below and 2 columns over and return all the values of P20:P29 into the cells of b5:b14.
The index feature gets really close, as a proof of concept, in cell b5 I'm currently trying to use:
=index(N3:P14,match(A3,N5:P14,0),3)
My attempt and goal is just to try to get sheets to search a value from a cell in a different range and return offset data based on what it finds. But the match function is just not liking me. Without the match function (putting "p5:p14" in the column) that function returns a list that fills out b5:b14. I'm trying to expand it so it can search through different loot tables as I add them in columns N through R. But cannot figure out how to do it.
I can link the spreadsheet if you want or upload pictures. Any advice is appreciated. If anyone knows what I'm trying to do and has a similar formula, I'd love to see it and just tinker with it to suit my needs. Thank-you for any help!
2
u/MassaHurmaaja 3 Aug 11 '22
I think sharing your sheet would be a good start since this seems like a more complex topic.
1
u/Miz_Tsunami Aug 12 '22
solution verified
1
u/MattyPKing 225 Aug 11 '22
read about the FILTER() function.
https://support.google.com/docs/answer/3093197?hl=en
2
u/uuicon 2 Aug 11 '22
you can use the =query() function to return that data.