How to transpose a single columns data with duplicates

Justplainj

Board Regular
Joined
Apr 15, 2021
Messages
50
Office Version
  1. 365
Platform
  1. Windows
Good day All,

I am not quite sure ow to explain this (struggling with the post/trhead subject name also).

I have a table of training data (peoples names that did training) from a new system we use with the amount of hours the employee did as well as the trainer names.
However when there is more than one trainer, the entire row is duplicated with the second trainers name in the trainer name column.

Example:
Below is an example of how the table looks like.
First row is headers.
Second row is the training Sara McDonald did with 2 hours training and the trainer is Peter Ros.
Third row is a duplicate row, with the second trainers name Laura Kay.

Important to take note of
1. The trainers are in the same session giving training.
2. There can sometimes be only 1 trainer, other times 2 or even more (max I have seen is 4 trainers duplicating the rows 4 times).
3. Due to the duplication of rows if there is more than one trainer it means simply doing a sum function on the training hours or pivoting the data etc to get statistical info provides incorrect stats.

Trainee NameTrainee SurnameTraining TitleTraining HoursTrainer Name
SaraMcDonaldExcel Training2Peter Ros
SaraMcDonaldExcel Training2Laura Kay
JimSmithExcel Training2Peter Ross
JimSmithExcel Training2Laura Kay

Is there a way to quickly get the data to display as per the following to only show the trainee information once with the trainer names in columns next to each other, either via features in excel, functions/formulas or vba?
I cannot simply remove the trainee names and remove duplicates because I require the trainer names to calculate the hourly rate of the trainee as that and allocate costs appropriately depending on how many hours they spent training, etc., and doing it manually is a pain seeing in the first month we have over 10,000 rows of data already.

Trainee NameTrainee SurnameTraining TitleTraining HoursTrainer Name 1Trainer Name 2
SaraMcDonaldExcel Training2Peter RosLaura Kay
JimSmithExcel Training2Peter RosLaura Kay

Thank you in advance.
J
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
How about
+Fluff 1.xlsm
ABCDEFGHIJKL
1Trainee NameTrainee SurnameTraining TitleTraining HoursTrainer Name
2SaraMcDonaldExcel Training2Peter RosSaraMcDonaldExcel Training2Peter RosLaura Kay
3SaraMcDonaldExcel Training2Laura KayJimSmithExcel Training2Peter RossLaura Kay
4JimSmithExcel Training2Peter Ross
5JimSmithExcel Training2Laura Kay
Master
Cell Formulas
RangeFormula
G2:J3G2=UNIQUE(A2:D5)
K2:L3K2=TRANSPOSE(FILTER(E2:E5,(A2:A5=G2)*(B2:B5=H2)*(C2:C5=I2)))
Dynamic array formulas.
 
Upvote 0
Solution
Good day Fluff,

You are a live saver.

Thank you very much this worked perfectly.

And here i was trying to do it with vlookups and index/match formulas etc. never thought of using the filter function.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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