Formula to return employee's name in cells adjacent to his/her family members

realtoast

New Member
Joined
Nov 24, 2015
Messages
47
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Experts, I have a table that has a single column containing the full names of all employees and their respective dependents. There's also a unique identifier (Employee Code) that associates all family members. I need a formula in a column to the left of the name column that places the employee's name adjacent to themselves and also adjacent to their family members.

Here's the current table, with no formulas, followed by the desired result.

Employee CodeEE NameNameRelationship
A5A0[formula here]SMITH, JOHN JACOBEmployee
A5A0SMITH, JENNYSpouse
A5A0SMITH, TIMOTHYChild
A5A0SMITH, AMYChild
A5A0SMITH, GARY MChild
A5A0SMITH, LILLYEChild
A1HDMILLER, SCOTT TIMOTHYEmployee
A58KMARTINEZ, SHELLYEmployee
A55XKELLER, MAXWELLEmployee
A59XJAMES, MARTIN SHORTEmployee
A3S4CANTELME, JAMES SEmployee
A4PPVIDOR, DARTHEmployee
A3AOMCCMILLAN, SCARLETEmployee
A59SPOLLY, TERRENCEEmployee
A59SPOLLY, MARY RSpouse
A1M3KIMBAL, MICHELLE AEmployee
A04DCOLLINGSWORTH, ANDREW TEmployee
A04DCOLLINGSWORTH, ELIZABETHSpouse
A04DCOLLINGSWORTH, SAMUEL KChild
A04DCOLLINGSWORTH, EMILYChild
A04DCOLLINGSWORTH, SCOTTYChild

Here's what it should look like when done:

Employee CodeEE NameNameRelationship
A5A0SMITH, JOHN JACOBSMITH, JOHN JACOBEmployee
A5A0SMITH, JOHN JACOBSMITH, JENNYSpouse
A5A0SMITH, JOHN JACOBSMITH, TIMOTHYChild
A5A0SMITH, JOHN JACOBSMITH, AMYChild
A5A0SMITH, JOHN JACOBSMITH, GARY MChild
A5A0SMITH, JOHN JACOBSMITH, LILLYEChild
A1HDMILLER, SCOTT TIMOTHYMILLER, SCOTT TIMOTHYEmployee
A58KMARTINEZ, SHELLYMARTINEZ, SHELLYEmployee
A55XKELLER, MAXWELLKELLER, MAXWELLEmployee
A59XJAMES, MARTIN SHORTJAMES, MARTIN SHORTEmployee
A3S4CANTELME, JAMES SCANTELME, JAMES SEmployee
A4PPVIDOR, DARTHVIDOR, DARTHEmployee
A3AOMCCMILLAN, SCARLETMCCMILLAN, SCARLETEmployee
A59SPOLLY, TERRENCEPOLLY, TERRENCEEmployee
A59SPOLLY, TERRENCEPOLLY, MARY RSpouse
A1M3KIMBAL, MICHELLE AKIMBAL, MICHELLE AEmployee
A04DCOLLINGSWORTH, ANDREW TCOLLINGSWORTH, ANDREW TEmployee
A04DCOLLINGSWORTH, ANDREW TCOLLINGSWORTH, ELIZABETHSpouse
A04DCOLLINGSWORTH, ANDREW TCOLLINGSWORTH, SAMUEL KChild
A04DCOLLINGSWORTH, ANDREW TCOLLINGSWORTH, EMILYChild
A04DCOLLINGSWORTH, ANDREW TCOLLINGSWORTH, SCOTTYChild
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
How about
Fluff.xlsm
ABCD
1Employee CodeEE NameNameRelationship
2A5A0SMITH, JOHN JACOBSMITH, JOHN JACOBEmployee
3A5A0SMITH, JOHN JACOBSMITH, JENNYSpouse
4A5A0SMITH, JOHN JACOBSMITH, TIMOTHYChild
5A5A0SMITH, JOHN JACOBSMITH, AMYChild
6A5A0SMITH, JOHN JACOBSMITH, GARY MChild
7A5A0SMITH, JOHN JACOBSMITH, LILLYEChild
8A1HDMILLER, SCOTT TIMOTHYMILLER, SCOTT TIMOTHYEmployee
9A58KMARTINEZ, SHELLYMARTINEZ, SHELLYEmployee
10A55XKELLER, MAXWELLKELLER, MAXWELLEmployee
11A59XJAMES, MARTIN SHORTJAMES, MARTIN SHORTEmployee
12A3S4CANTELME, JAMES SCANTELME, JAMES SEmployee
13A4PPVIDOR, DARTHVIDOR, DARTHEmployee
14A3AOMCCMILLAN, SCARLETMCCMILLAN, SCARLETEmployee
15A59SPOLLY, TERRENCEPOLLY, TERRENCEEmployee
16A59SPOLLY, TERRENCEPOLLY, MARY RSpouse
17A1M3KIMBAL, MICHELLE AKIMBAL, MICHELLE AEmployee
18A04DCOLLINGSWORTH, ANDREW TCOLLINGSWORTH, ANDREW TEmployee
19A04DCOLLINGSWORTH, ANDREW TCOLLINGSWORTH, ELIZABETHSpouse
20A04DCOLLINGSWORTH, ANDREW TCOLLINGSWORTH, SAMUEL KChild
21A04DCOLLINGSWORTH, ANDREW TCOLLINGSWORTH, EMILYChild
22A04DCOLLINGSWORTH, ANDREW TCOLLINGSWORTH, SCOTTYChild
Sheet6
Cell Formulas
RangeFormula
B2:B22B2=XLOOKUP(A2,$A$2:$A$100,$C$2:$C$100)
 
Upvote 0
Solution
Awesome! I suspected XLOOKUP() would be in the solution, but I just can't get my head to understand it.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,616
Latest member
intern444

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