How to List and Sort Unique Values and Text in Microsoft Excel

Configurare noua (How To)



Pasi de urmat
Use the UNIQUE Function in Excel

You can use the UNIQUE function for text or numbers, decide how to compare the cell range, and opt to show results that only appear once.

The syntax for the function is UNIQUE(array, column, only once) where only the first argument is required. Include the column argument to compare columns instead of rows and the only once argument to return values that occur only one time in the array.

Should you choose to include the optional arguments, you’ll use the TRUE indicator in the formula for each. If no indicator is included, the function assumes FALSE.

As an example, we’ll create a list of customers for an email blast. Rather than use the existing list in cells A2 through A10 because some customers ordered more than once, we’ll make a new list where each customer appears one time.


UNIQUE function in Excel
 For another example, we’ll add the third argument, only once, to find those customers who’ve only ordered once.
UNIQUE function for data appearing once
Because the second argument assumes FALSE if nothing is included, we simply add 
a comma after the first argument and then another comma before the last argument. 
Alternatively, you can use this formula to obtain the same result:
You can use the UNIQUE function to list distinct values as well as text. 
In this formula, we can list unique dates:
UNIQUE function for dates
Sort the List Automatically

As mentioned, you can sort the list automatically at the same time you use the UNIQUE function to create it. To do this, you simply add the SORT function to the beginning of the formula.

The syntax for this function is SORT(array, index, order, column) where only the first argument is required. Using the first list of unique customers we created above and sort it immediately, you would use this formula:

=SORT(UNIQUE(A2:A10)) As you can see, the UNIQUE formula is the required array argument for the SORT function.

Sort values in ascending order

By default, the SORT function lists items in ascending order. To sort the same list in descending order, you would use the following formula which adds the order argument.

=SORT(UNIQUE(A2:A10),,-1) Notice here we have a double comma again. This is because we don’t want the index argument, only the order argument.  Use 1 for ascending order and -1 for descending order. If no value is used, the function assumes 1 by default.

Sort values in descending order

Combine Unique Values

One more handy addition to the UNIQUE function allows you to combine values.

For instance, maybe your list has values in two columns instead of just one as in the screenshot below.

First and last names to combine

By adding the ampersand (&) operator and a space, we can create a list of first

and last names of unique customers with this formula:

=UNIQUE(A2:A10&" "&B2:B10)

 To break down the formula, the first array, A2 through A10, 
contains the first names, the ampersands concatenate the first names to 
the last names in B2 through B10 with a space between them in quotes.
Combine unique first and last names

You can also include the SORT function here to put your list 
in ascending order with this formula:

=SORT(UNIQUE(A2:A10&” “&B2:B10)) Combine and sort unique first and last names

Just like you might want to highlight duplicate values in Excel, you may want to find unique ones. Keep the UNIQUE function and these additional ways to use it in the mind the next time you need to create a list of distinct values or text in Excel.

Tip solutie



(2 din 3 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?