Home » excel » Split a column into multiple based on categories in excel

Split a column into multiple based on categories in excel

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am trying to split some data which is in excel, a sample of it is,

DATE        NAME    NUMBER
19700228    AERO    9
19700228    AGRIC   6
19700228    AUTOS   5
19700228    BANKS   10
19700228    BEER    10
19700228    BLDMT   7
19700228    BOOKS   3
19700228    BOXES   1
19700228    BUSSV   9
19700229    AERO    10
19700229    AGRIC   2
19700229    AUTOS   10
19700229    BANKS   5
19700229    BEER    9
19700229    BLDMT   3
19700229    BOOKS   7
19700229    BOXES   5
19700229    BUSSV   1

I would like each NAME to have its own column,

i.e.
enter image description here

Is this possible in excel, also, each category could have different dates and I would need them to line up.

How to&Answers:

Create a pivot table with the NAME field as the Columns and DATE as the Rows.

Answer:

Your first goto should definitely be a Pivot Table, explained by @StevenCarlson.

However, you could try this principle:

enter image description here

Formula F1 and drag right:

{=INDEX($B$2:$B$19,MATCH(0,COUNTIF($E$1:E1,$B$2:$B$19),0))}

Formula E2 and drag down:

{=INDEX($A$2:$A$19,MATCH(0,COUNTIF($E$1:E1,$A$2:$A$19),0))}

Formula F2 and drag down and right:

=INDEX($C$1:$C$19,SUMPRODUCT(($A$2:$A$19=$E2)*($B$2:$B$19=F$1)*ROW($A$2:$A$19)))

First two formulas are entered through CtrlShiftEnter