Look up - while loop

djxela

New Member
Joined
Sep 22, 2011
Messages
6
Hi all,


I have a list of of employees with a unique number assigned to each one.
Then i have a separate list with the entire list of employees and their 1Up manager as well as their 2 Up manager.


I need a script that will look up that employee on the list, finds their 1 UP manager, checks that 1 Up manager to see if the Job Band is A otherwise keep going and look up their managers manager until it finds the person that has a Job Band A and returns that employee ID as well as on a separate column return the employee ID of the manager before him
So basically i am looking to see who the top two managers are.


See below example if we look for Stacey Party the top Manager would be Alex Burn as his Job Band is A and then 2nd top manager is Mike Freespirit


Employee NoLast NameFirst NameJob Band1-up employee no.1-up manager name2-up employee no.2-up manager NameTop Manager2nd top Manager
37975696PartyStacy3i49114594John Smith46741146Nikita Walter4674070937224331
49114594JohnSmith246741146Nikita Walter37224331Mike Freeespirit4674070937224331
46741146WalterNikita137224331Mike Freeespirit46740709Alex Burn4674070937224331
37224331FreespiritMikeC46740709Alex Burn46516969Andy Braun4674070937224331
46740709BurnAlexA46516969Andy Braun0

<colgroup><col><col><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,214,987
Messages
6,122,613
Members
449,090
Latest member
vivek chauhan

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