Moving Data some duplicated

scooby51

New Member
Joined
Apr 6, 2012
Messages
15
Good Morningall,


I am looking for a formula to helpin moving data on a spreadsheet.
Column A contains names, eachname is duplicated over 2 rows.
Column B contains animals, each name has an animal in eachrow.
I need to have in:
Column D – a list of single names from column A
Column E – first animal (column B) attributed to the name incolumn A
Column F – second animal (column B) attributed to the namein column A
<strike>
</strike>

[TABLE="width: 384"]
<colgroup><col width="64" style="width:48pt" span="6"> </colgroup><tbody>[TR]
[TD="width: 64, bgcolor: transparent"]A[/TD]
[TD="width: 64, bgcolor: transparent"]B[/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"]D[/TD]
[TD="width: 64, bgcolor: transparent"]E[/TD]
[TD="width: 64, bgcolor: transparent"]F[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]ab[/TD]
[TD="bgcolor: transparent"]cat[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"]ab[/TD]
[TD="bgcolor: transparent"]cat [/TD]
[TD="bgcolor: transparent"]dog[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]ab[/TD]
[TD="bgcolor: transparent"]dog[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"]bc[/TD]
[TD="bgcolor: transparent"]cow[/TD]
[TD="bgcolor: transparent"]sheep[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]bc[/TD]
[TD="bgcolor: transparent"]cow[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"]cd[/TD]
[TD="bgcolor: transparent"]bird[/TD]
[TD="bgcolor: transparent"]fish[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]bc[/TD]
[TD="bgcolor: transparent"]sheep[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"]de[/TD]
[TD="bgcolor: transparent"]rat[/TD]
[TD="bgcolor: transparent"]goat[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]cd[/TD]
[TD="bgcolor: transparent"]bird[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]cd[/TD]
[TD="bgcolor: transparent"]fish[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]de[/TD]
[TD="bgcolor: transparent"]rat[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]de[/TD]
[TD="bgcolor: transparent"]goat[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]


Any help will be much appreciated.
S
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
with PowerQuery (Get&Transform)

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]Name[/td][td=bgcolor:#5B9BD5]Animal[/td][td][/td][td=bgcolor:#70AD47]Name[/td][td=bgcolor:#70AD47]Animal.1[/td][td=bgcolor:#70AD47]Animal.2[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]ab[/td][td=bgcolor:#DDEBF7]cat[/td][td][/td][td=bgcolor:#E2EFDA]ab[/td][td=bgcolor:#E2EFDA]cat[/td][td=bgcolor:#E2EFDA]dog[/td][/tr]

[tr=bgcolor:#FFFFFF][td]ab[/td][td]dog[/td][td][/td][td]bc[/td][td]cow[/td][td]sheep[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]bc[/td][td=bgcolor:#DDEBF7]cow[/td][td][/td][td=bgcolor:#E2EFDA]cd[/td][td=bgcolor:#E2EFDA]bird[/td][td=bgcolor:#E2EFDA]fish[/td][/tr]

[tr=bgcolor:#FFFFFF][td]bc[/td][td]sheep[/td][td][/td][td]de[/td][td]rat[/td][td]goat[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]cd[/td][td=bgcolor:#DDEBF7]bird[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]cd[/td][td]fish[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]de[/td][td=bgcolor:#DDEBF7]rat[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]de[/td][td]goat[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table12"]}[Content],
    Group = Table.Group(Source, {"Name"}, {{"Count", each _, type table}}),
    ListDist = Table.AddColumn(Group, "Animal", each List.Distinct(Table.Column([Count],"Animal"))),
    Extract = Table.TransformColumns(ListDist, {"Animal", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
    Split = Table.SplitColumn(Extract, "Animal", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Animal.1", "Animal.2"})
in
    Split[/SIZE]
 
Upvote 0
Or with formulae


Excel 2013/2016
ABCDEF
1ABDEF
2abcatabcatdog
3abdogbccowsheep
4bccowcdbirdfish
5bcsheepderatgoat
6cdbird
7cdfish
8derat
9degoat
Sheet2
Cell Formulas
RangeFormula
D2=IFERROR(INDEX($A$2:$A$9,MATCH(0,INDEX(COUNTIF($D$1:D1,$A$2:$A$9),0),0)),"")
E2=IFERROR(INDEX($B$2:$B$9,MATCH(D2,$A$2:$A$9,0)),"")
F2=IFERROR(INDEX($B$2:$B$9,AGGREGATE(15,6,ROW($B$2:$B$9)-ROW($B$2)+1/($A$2:$A$9=D2),2)),"")
 
Last edited:
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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