This is sometimes referred to as a “pivot” operation.

Modern approach

Several new functions in the current version of Excel make this task easier.

This formulaspillsthe four unique group names into the range E4:H4.

INDEX and SMALL array formula for legacy Excel

With the groups in place, we now have what we need to retrieve the names in each group.

As the formula is copied across, the reference to E5 isrelativeand changes at each new row.

The result is all names in each group are together in the same column.

INDEX and SMALL array formula for legacy Excel

However, Excel formulas won’t currently return anarray-of-arraysso this doesn’t work.

It does this by testing the group in cell E4 against all values in the named rangegroup.

When the result is TRUE, the IF function returns the row number (see next step).

INDEX and SMALL array formula for legacy Excel

This array goes into SMALL as thearrayargument.

The result is that the SMALL function returns the row number for each name in a given group.

This happens after all names for a given group have been extracted.

INDEX and SMALL array formula for legacy Excel

To suppress this error, we wrap the formula in theIFERROR functionand return anempty string("").

The output from FILTER is dynamic.

If source data or criteria change, FILTER will return a new set of results.

INDEX and SMALL array formula for legacy Excel

Values can be sorted by one or more columns.

SORT returns a dynamic array of results.

you’re able to use INDEX to retrieve individual values, or entire rows and columns.

Excel formula: Multiple matches into separate columns

from a set of numeric data.

IFERROR is an elegant way to trap and manage errors without using more complicated nested IF statements.

ROW Function

The Excel ROW function returns the row number for a reference.

Excel formula: Get nth match with INDEX / MATCH

For example, ROW(C5) returns 5, since C5 is the fifth row in the spreadsheet.

When no reference is provided, ROW returns the row number of the cell which contains the formula.

ROWS Function

The Excel ROWS function returns the count of rows in a given reference.

Excel formula: Get relative row numbers in range

Excel FILTER function

Excel UNIQUE function

Excel SORT function

Excel TRANSPOSE function

Excel INDEX function

Excel SMALL function

Excel IFERROR function

Excel ROW function

Excel ROWS function

INDEX and SMALL array formula for legacy Excel