First, if you’re jumping through this many hoops you should consider the options above. Reformat the data, or use pivot tables.
Having said that, Excel can generally be bent to your will with some effort and some Googling.
Let’s build on the work Ruminator did. You can use some trickery to automate the same query so we’re not having to repeat it for each item.
First I’ve separated this onto it’s own tab, I’m assuming that your data is in a tab called ‘Data’. You have to put these formulas onto their own tab otherwise the search formula will run into itself at some point and all hell will break loose (actually it’ll just stop working).
The formula’s Ruminator used uses indirect references building cell references out of text. To make life easier I’m going to separate them out adding them to L2 and M2 as such:
L2 ="Data!B"&$K$2&":BZ"&$K$2
M2 ="Data!B"&$K$2
Now when you change the name in K1 you’ll see the references change in L2 and M2.
Next I’m going to use a ‘find Xth blank’ formula so I need a value for X. I put a ‘0’ in M3 and make M4=M3+1.
The magic formula is the following one, I’m putting this in L4
M4=INDEX(INDIRECT($L$2),SMALL(IF(INDIRECT($L$2)<>"",COLUMN(INDIRECT($L$2))-COLUMN(INDIRECT($M$2))+1),M4))
This is an array formula so when you enter it hit CTRL+SHIFT+ENTER not just enter. When you look at the contents of M4 you should see curly braces round it like this:
{=INDEX(INDIRECT($L$2),SMALL(IF(INDIRECT($L$2)<>"",COLUMN(INDIRECT($L$2))-COLUMN(INDIRECT($M$2))+1),M4))}
The array formula is applied to all the values in the range referenced, which is why it can find the ‘Xth’ value as defined by the counter in M4.
If all is working you should see (starting at K1, I’ve deleted Ruminator’s formula from K3).
Barbara
3 Data!B3:BZ3 Data!B3
0
22222 1
Feel free to change the name to see the change. To get the ‘desk/chair/whatever’ we can lookup the serial number so in K4 put
K4=LOOKUP(L4, INDIRECT($L$2), Data!B$1:BZ$1)
Finally grab cells K4 to M4 and select a few lines below, and copy down. You should end up with …
Barbara
3 Data!B3:BZ3 Data!B3
0
Desk 22222 1
Table 33333 2
#NUM! #NUM! 3
#NUM! #NUM! 4
#NUM! #NUM! 5
There are some limitations, this is only reading from columns B to BZ, but you could change the reference in L2 to make the range different. But array formulas are limited to a certain number of values so you can’t just reference all of row 3.
Also array formulas are a pain because you have to remember to enter them with the CTRL+SHIFT+ENTER combo every time you edit it. And you will edit it at some point, and you will forgot and you will sit confused as everything breaks. Well, I least I do.
However array formulas allow you to do lots of cool stuff once you’re used to them, although I suspect I could do similar if I learned how the hell pivot tables work.
Finally we’re assuming the serial numbers are unique per person, if not the lookup for the equipment type will not (always) work. In that case several more hoops would need to be jumped through. But I’ve wasted enough work time for now.
If it were me I’d start another tab to suck the results out of the tab above, you could add in some IF’s to hide the ‘NUM’ error when there’s no matches. Then hide the tab with all the working on it so all the grubbiness is out of sight.
Hope that helps,
SD