# Denormalize Excel Data

I don't know that "denormalize" is technically the correct term, so to you database guys, I apologize up front, but it's the best I could come up with to describe my need.

I am being given the output of a relational database in Excel format, where there is a one-to-many relationship between "person name" and "position code". For each person, one row is output for each position held. The "key" is the name, which is the "one" side of the relationship.

I'm not bad with Excel, but this is beyond my pay grade: I want to have, for each name, a cell that has the concatenated set of positions to which that person is assigned. An example:

Input
``````Name   | Position
John   | AA
John   | BB
Tom    | AA
Harry  | BB
Harry  | CC
Harry  | DD
``````
Desired Output:
``````Name   | Positions
John   | AA, BB
Tom    | AA
Harry  | BB, CC, DD
``````
If at all humanly possible, I do NOT want to use VBA, and stay fully within the Excel environment to solve the problem.
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

Hello,

Excel does not provide that functionality out of the box. You would need a custom formula written with VBA.

The closest you can get with out of the box functionality is to build a pivot table as the attached.

cheers, teylyn
Pivot.xlsx
propertytax

Yeah, I ran down the Pivot Table rabbit hole myself; I've seen some very fancy things done with VLOOKUP and am hoping someone clever can put something together, but if VBA is the only solution I'm going to have to go another route :-(

Thanks for the suggestion, though.
Hi, propertytax.

(1) In your source example, all of the entries for an individual are grouped together. Is this true for the actual data?
(2) May we add a helper column (or two!) beside the source data?
(3) May we assume a maximum no. of entries?
(4) How does the source data get from the database to the spreadsheet which will contain the results?

Thanks,
Brian.

1) The entries for each name are grouped by name; further, they are sorted by name ascending, which is the primary (and only) sort key

2) Yes, we're free to add any helper columns we would care to, the data is "branched" from the database and we can manipulate at will

3) We may assume a maximum of 4 positions per name

4) The data is delivered to me as an Excel spreadsheet; I have no direct access to the database itself.

I've been playing with ARRAY formulas but I am just so terrible at those, I haven't a clue where to start.
SOLUTION
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.

membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.