Looking for some help again.
Many months ago I needed to create a spreadsheet for work and have it grab values. I used vlookup to accomplish this task. Now I need to be able to find if my vlookup has a second, third or fourth entry and tabulate it on another sheet.
Example table:
Equipment/Cost code/hours
Car/1/10
truck/1/10
car/2/10
boat/1/10
plane/1/10
How can I use vlookup to find the second car in the list above. I would then need to pull that cost code? This is how I have been finding the first occurrence if there is one
=IF(ISNA(VLOOKUP("*"&"F"&"*"&"150"&"*",'Daily Report Wed'!$A$53:$G$63,6,FALSE)),0,VLOOKUP("*"&"F"&"*"&"150"&"*",'Daily Report Wed'!$A$53:$G$63,6,FALSE))
Any help is greatly appreciated.
Here's a way to do it without the concatenating:
{=INDEX($B$2:$B$7,SMALL(IF($G$1=$A$2:$A$7,ROW($A$2:$A$7)-ROW($A$2)+1),1))}
Make sure you press Ctrl + Shift + Enter when entering it, to add the curly brackets, as it's an array formula.
Here's what my test sheet looks like:
http://puu.sh/jJkMf/3c348011fa.png
To get the 2nd, 3rd, nth value in the list, you'll have to change that last value to be which value you're looking for:
{=INDEX($B$2:$B$7,SMALL(IF($G$1=$A$2:$A$7,ROW($A$2:$A$7)-ROW($A$2)+1),1))} -> Returns the 1st occurrence
{=INDEX($B$2:$B$7,SMALL(IF($G$1=$A$2:$A$7,ROW($A$2:$A$7)-ROW($A$2)+1),2))} -> returns the 2nd occurrence
...
{=INDEX($B$2:$B$7,SMALL(IF($G$1=$A$2:$A$7,ROW($A$2:$A$7)-ROW($A$2)+1),n))} -> returns the nth occurrence
hope that helps.
Oh, and for future purposes, IFERROR is a quick and easy way to handle vlookup errors. For example:
=IFERROR(VLOOKUP("*"&"F"&"*"&"150"&"*",'Daily Report Wed'!$A$53:$G$63,6,FALSE),0)
Instead of your if statement above, returns the same results, but is m
uch easier to modify/change as you only have to change one vlookup instead of 2 when making changes.