Look Up returning multiple columns and rows

twnovak

New Member
Joined
Oct 8, 2013
Messages
4
I'm working on a database right now for our school, similar to a directory. What I want to do is be able to look up what items a staff member has been issued and when/if they were returned. What I have right now is one sheet with all the information about the staff that looks like the one below. I want to create a separate sheet where you could look up a staff member by last name and can find all the information in the array relative the the specific cell looked up.

Last NameFirst NamePositionBuildingItems
DoeJanePrincipalHigh SchoolCell Phone
ID Badge
Keys
Radio
SmithJohnHR DirectorAdmin Ctr.Cell Phone
ID Badge
iPad
Keys
Projector

<tbody>
</tbody>



So, on the "lookup" sheet, I want to be able to input either Doe and have the look up return cells B2:E6, or if I input Smith it should return cells B7:D11.

I've been experimenting with Vlookup, hlookup, index, and match but haven't been able to get exactly what I want. Any help would be much appreciated.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
As a work around could you have the items going across columns rather than down rows.

The for example D1 = Cell Phone to D4 = Radio at the end you could put in cell D5:

=D1&","&D2&","&D3&","&D4

Then lookup to this column D5 ?
 
Upvote 0
As a work around could you have the items going across columns rather than down rows.
The for example D1 = Cell Phone to D4 = Radio at the end you could put in cell D5:
Then lookup to this column D5 ?

Thanks for the suggestion. I originally had a column for Item 1 - Item 5, but my supervisor wants to also keep track of when the items were checked out, when they were returned, and who they were returned to. That would mean I'd need 20 columns, which doesn't look good, so he wants it in the format above.

Do you know how to have an equation that would return the results 6 cells right and 2 cells down from the cell you looked up, or return a group of cells like B2:E5?
 
Upvote 0
I've come up with a kind of solution. It's a little odd, but might do the trick. Let me know if this works for you.

I have the inputs here:

Sheet15
ABCDE
1Last NameFirst NamePositionBuildingItems
2DoeJanePrincipalHigh SchoolCell Phone
3ID Badge
4Keys
5Radio
6SmithJohnHR DirectorAdmin Ctr.Cell Phone
7ID Badge
8iPad
9Keys
10Projector
11CooperRyanTeacherElementaryCell Phone
12ID Badge
13Laptop

<tbody>
</tbody>

Entering last name in A1 here, and getting the results starting in A3. I'll show all three results:

ABCDE
1Doe4
2
3DoeJanePrincipalHigh SchoolCell Phone
4ID Badge
5Keys
6Radio
7

<tbody>
</tbody>
Sheet16



ABCDE
1Smith5
2
3SmithJohnHR DirectorAdmin Ctr.Cell Phone
4ID Badge
5iPad
6Keys
7Projector
8

<tbody>
</tbody>
Sheet16



ABCDE
1Cooper999
2
3CooperRyanTeacherElementaryCell Phone
4ID Badge
5Laptop
6

<tbody>
</tbody>
Sheet16



B2 -->
Code:
=IF(ISNA(MATCH(FALSE,NOT(ISTEXT(INDEX(Sheet15!$A$2:$A$30,MATCH($A$1,Sheet15!$A$2:$A$30,0)+1):Sheet15!$A$30)),0)),999,MATCH(FALSE,NOT(ISTEXT(INDEX(Sheet15!$A$2:$A$30,MATCH($A$1,Sheet15!$A$2:$A$30,0)+1):Sheet15!$A$30)),0))
Confirmed with Ctrl+Shift+Enter ^^^.

A3 (and filled down and across) -->
Code:
=IF(ROWS(A$3:A3)<=$B$1,SUBSTITUTE(OFFSET(Sheet15!$A$1,MATCH($A$1,Sheet15!$A$2:$A$30,0)+ROW(Sheet15!$A1)-1,COLUMN(Sheet15!A$1)-1),0,"",1),"")
 
Upvote 0
BSchwartz, this seems to be working with a few glitches. Some of the dates are returning without zeros and a few of the cells are returning blank. Could I PM you with and we could exchange sheets?
 
Upvote 0
I figured it out the glitch with the cells returning blank. Haven't been able to figure out why they are returning some without the zeros in the date (i.e. 2012 returns 212)
 
Upvote 0
How about creating a pivot table?

In order to make it work you would need to fill out last name, first name etc in all the lines. But it can easily be fixed by referencing to the cell above. I.e. filter on the blank cells, if forinstance a3 is blank =a2. Then copy down to the other blank cells.
Then create the pivot table...
 
Upvote 0
I wasn't aware that you had dates in the dataset. Try this instead:

=IF(AND(ROWS(A$3:A3)<=$B$1,OFFSET(Sheet15!$A$1,MATCH($A$1,Sheet15!$A$2:$A$30,0)+ROW(Sheet15!$A1)-1,COLUMN(Sheet15!A$1)-1)<>0),OFFSET(Sheet15!$A$1,MATCH($A$1,Sheet15!$A$2:$A$30,0)+ROW(Sheet15!$A1)-1,COLUMN(Sheet15!A$1)-1),"")
 
Upvote 0

Forum statistics

Threads
1,216,163
Messages
6,129,223
Members
449,495
Latest member
janzablox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top