which return the 6 unique rows in the range B5:C15, sorted by group. By default, UNIQUE will extract unique values in rows, so there is no special configuration needed. Working from the inside out, we give UNIQUE the full range of data, including the Group and Color columns: The UNIQUE function evaluates all 11 rows and returns the 6 unique rows in an unsorted two-dimensional array that looks like this: This array is returned directly to the SORT function: By default, SORT will sort based on the first column in the data. The result is the same array, sorted by Group: UNIQUE is a dynamic function. If any data in B5:C15 changes, the output from UNIQUE will update immediately.

Dynamic source range

UNIQUE won’t automatically adjust the source range if data is added or deleted. To give UNIQUE a range that will automatically resize as needed, use an Excel Table or create a dynamic named range with a formula.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.