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>

ABDEF
abcatabcat dog
abdogbccowsheep
bccowcdbirdfish
bcsheepderatgoat
cdbird
cdfish
derat
degoat

<colgroup><col width="64" style="width:48pt" span="6"> </colgroup><tbody>
</tbody>


Any help will be much appreciated.
S
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
with PowerQuery (Get&Transform)

NameAnimalNameAnimal.1Animal.2
abcatabcatdog
abdogbccowsheep
bccowcdbirdfish
bcsheepderatgoat
cdbird
cdfish
derat
degoat

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,215,394
Messages
6,124,683
Members
449,180
Latest member
kfhw720

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