Vlookup - Display Next Record

choli0090

New Member
Joined
Aug 18, 2009
Messages
42
Hi Everyone, I'm trying to figure out a vlookup that will display the first result & in the next cell, display the 2nd result, etc

On One sheet (tab), There can be multiple rows of the same Employee ID & Customer Name. What I'm trying to do is on the "Employee" sheet (tab) is bring back only once instance of Customer name & Subtype, IF the "In Region" column is equal to "Y"

Is this something that can be done, or would a pivot need to be used to collapse the customer name down to one record & apply a filter on "In Region" = Y

Thanks!

Sheet - "Customer"

Emp ID Customer SubType In Region
AAAA AAA A Y
AAAA AAA A Y
AAAA AAA A Y
AAAA BBB A Y
AAAA BBB A Y
AAAA BBB B Y
AAAA BBB B Y
AAAA BBC A N
AAAA BBC A N
BBBB CCC A Y
BBBB CCC A Y
BBBB CCC A Y


Sheet - "Employee"

Emp ID AAAA

Customer SubType
AAA A
BBB A
BBB B
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Customer Sheet
A
B
D
1emp ID
customer
Sub type
2AAAA
AAA A
Y
3AAAA
AAA A
Y
4AAAA
AAA A
Y
5AAAA
BBB A
Y
6AAAA
BBB A
Y
7AAAA
BBB B
Y
8AAAA
BBB B
Y
9AAAA
BBC A
N
10AAAA
BBC A
N
11BBBB
CCC A
Y
12BBBB
CCC A
Y
13BBBB
CCC A
Y

<tbody>
</tbody>


Employee Sheet

AB
1Emp IDAAA
2
3Cutomer IDSubtype
4AAA A
5BBB A
6BBB A
7BBB C

<tbody>
</tbody>

In A4 of Employee sheet and copy down
This is an array formula and must be committed with CONTROL+SHIFT+ENTER. If done correctly Excel will put {} around the formula.
Code:
=IFERROR(INDEX(Customer!$B$2:$B$13,SMALL(IF(FREQUENCY(IF(ISNUMBER(SEARCH($B$1,Customer!$A$2:$A$13)),MATCH(Customer!$B$2:$B$13,Customer!$B$2:$B$13,0)),ROW(Customer!$B$2:$B$13)-ROW(Customer!$B$1)+1),ROW(Customer!$B$2:$B$13)-ROW(Customer!$B$1)+1),ROWS($A$4:A4))),"")
 
Upvote 0
Try a pivot table

Something like this

Emp ID​
AAAA​
Region​
Y​
Customer​
SubType​
AAA​
A​
BBB​
A​
BBB​
B​

<tbody>
</tbody>


Emp ID and Region --> Report Filter
Customer and Sub Type --> Row Labels

Pick Tabular Form in PivotTable Tools > Design > Report Layout
Right-click in Customer field click in Settings > Print & Layout and check Repeat items label checkbox
Remove Grand Total row

M.
 
Upvote 0
Thank you for this. This seems to work, with the exception on how to only have it bring back the customers that belong to that particular Employee. For instance on the "Employee" sheet Cell G1 contains the Employee ID. I want to bring in the customers that the employee sheet!Cell G1 matches on the Customer sheet Row A
 
Upvote 0
Hi Marcelo, Thank you for the suggestion. I've been asked to automate entry into a certain section on the spreadsheet. For instance when they enter in the sales ID on the Employee tab, that particular employee's customers (data source on another tab) would automatically populate.

I'm not sure exactly how a pivot would help with the automation. However I would agree it would help if I was going to "Copy & paste" it from the pivot to the employee tab.

Last, Isn't the "Check Repeat Items Label" an Excel 2010 feature? I'm using 2007
 
Upvote 0
Hi Marcelo, Thank you for the suggestion. I've been asked to automate entry into a certain section on the spreadsheet. For instance when they enter in the sales ID on the Employee tab, that particular employee's customers (data source on another tab) would automatically populate.

I'm not sure exactly how a pivot would help with the automation. However I would agree it would help if I was going to "Copy & paste" it from the pivot to the employee tab.

Last, Isn't the "Check Repeat Items Label" an Excel 2010 feature? I'm using 2007

You asked about the possibility of using a Pivot Table, so i thought that the users could use it, changing the Report Filter fields as desired.
Yes, "Repeat Items Label" feature is available only in Excel 2010 or more recent versions. Next time, please, tell us your Excel version.
Do you need a formula solution? Scott T has suggested one.

M.
 
Upvote 0

Forum statistics

Threads
1,214,948
Messages
6,122,420
Members
449,083
Latest member
Ava19

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