Author: Oscar Cronquist Article last updated on July 31, 2017

In a previous post I created unqiue distinct column headers (A20:C20) and then categorized adjacent cell values into each column (vba).

In this post I´ll show you how to do the same using only excel formulas.

### Create unique distinct column headers

Array formula in B20:

=INDEX(\$B\$4:\$B\$13, MATCH(0, COUNTIF(\$A\$20:A20, \$B\$4:\$B\$13), 0)) + CTRL + SHIFT + ENTER.

Copy (CTRL + C) cell B20 and paste (Ctrl + V) into cells C20 and D20. See picture below.

### Categorize cell values into each column

Array formula in B21:

=INDEX(\$C\$4:\$C\$13, SMALL(IF(\$B\$4:\$B\$13=B\$20, ROW(\$B\$4:\$B\$13)-MIN(ROW(\$B\$4:\$B\$13))+1, ""), ROW(A1))) + CTRL + SHIFT + ENTER

Copy (CTRL + C) cell B21 and paste (Ctrl + V) into cells B21:C23 and D21:D24. See picture below.

Categorize data into multiple columns (formulas).xls
(Excel 97-2003 Workbook *.xls)

MATCH(lookup_value;lookup_array; [match_type]
Returns the relative position of an item in an array that matches a specified value

INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range

IF(logical_test;[value_if:true];[value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE

ROW(reference) returns the rownumber of a reference

COUNTIF(range,criteria)
Counts the number of cells within a range that meet the given condition

MIN(number1,[number2])
Returns the smallest number in a set of values. Ignores logical values and text

SMALL(array,k) returns the k-th smallest row number in this data set.