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

Modern approach

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

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

INDEX and SMALL array formula for legacy Excel

As a final result, we have all names in each group together in the same row.

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

The trick is that SMALL is working with an array that is already filtered by group.

INDEX and SMALL array formula for legacy Excel

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

When the result is true, the IF function returns the row number.

This array goes into SMALL as thearrayargument.

INDEX and SMALL array formula for legacy Excel

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

This number is supplied to the INDEX function asrow_num, with the named rangenameas the array.

Finally, INDEX returns the name associated with each row number.

INDEX and SMALL array formula for legacy Excel

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

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

The output from FILTER is dynamic.

INDEX and SMALL array formula for legacy Excel

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

Values can be sorted by one or more columns.

SORT returns a dynamic array of results.

Excel formula: Multiple matches into separate rows

SEQUENCE Function

The Excel SEQUENCE function generates a list of sequential numbers in an array.

The array can be one dimensional, or two-dimensional, determined byrowsandcolumnsarguments.

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

Excel formula: Get nth match with INDEX / MATCH

from a set of numeric data.

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

COLUMN Function

The Excel COLUMN function returns the column number for a reference.

Excel formula: Get relative row numbers in range

For example, COLUMN(C5) returns 3, since C is the third column in the spreadsheet.

When no reference is provided, COLUMN returns the column number of the cell which contains the formula.

COLUMNS Function

The Excel COLUMNS function returns the count of columns in a given reference.

Excel formula: Multiple matches in comma separated list

Excel FILTER function

Excel UNIQUE function

Excel SORT function

Excel SEQUENCE function

Excel INDEX function

Excel SMALL function

Excel IFERROR function

Excel COLUMN function

Excel COLUMNS function

INDEX and SMALL array formula for legacy Excel