HomeGoogle DocsSpreadsheetFilter Distinct Columns or Rows in Google Sheets - UNIQUE Improvements

Filter Distinct Columns or Rows in Google Sheets – UNIQUE Improvements

Published on

Do you know how to get/filter distinct columns or rows using a formula in Google Sheets? If not, please read on. One of the Google Sheets functions has this additional capability now!

This post is about a new update in Google Sheets. Yep! The UNIQUE function in it now supports not only filtering rows but also columns.

There is an additional capability too. That’s the topic of this post.

I mean, the above-said function now supports filtering distinct columns or rows in Google Sheets. Earlier, we were using workarounds for the same.

You can see the updated syntax by typing =UNIQUE( in a blank cell in one of your Google Spreadsheet files.

Earlier Workarounds

Distinct Rows (Rows Existing Exactly Once in the Range) – For this, I used Query in the past. Here is that related tutorial – How to Find Distinct Rows in Google Sheets Using Query.

Distinct Columns (Columns Existing Exactly Once in the Range) – In fact, there is no existing tutorial in this blog that offers a workaround. But possibly the above Query method will work in this case too by applying TRANSPOSE.

That’s (the workarounds) the story of the recent past.

Below, I will explain the use of the new arguments/parameters in UNIQUE that the new update/improvement brings. On the course, you can learn the following.

  1. How to get/filter distinct columns using the UNIQUE function Google Sheets.
  2. How to get/filter distinct rows using the UNIQUE function in Google Sheets.
  3. Filtering unique columns.
  4. Filtering unique rows (already were in practice).

Regarding the third point, you should understand one thing. Earlier, the function was only supporting to make the rows unique (point # 4). Now it supports columns too.

All that new UNIQUE function features you can learn with examples below.

New Syntax

Earlier Syntax: UNIQUE(range)

New Syntax: UNIQUE(range, [by_column], [exactly_once])

The two new optional arguments are within the square brackets.

In this new syntax, by_column determines whether to unique rows or columns in the range.

What about exactly_once?

This argument determines whether to filter distinct columns or rows using Unique.

Please note that the new update won’t affect your existing Unique formulas in your sheet.

Because by default the two new arguments are set to FALSE. That means the function without those arguments will work as earlier.

Let me clear things for you.

Filter Unique Rows In Google Sheets

Here is one example.

To filter the unique rows in the range B2:D5 (please refer to the image below), we can use the UNIQUE formula as earlier.

=UNIQUE(B2:D5)

I have omitted the two optional arguments since it’s already set to FALSE. If you want, use those arguments as below.

=UNIQUE(B2:D5,false,false)

Both the formulas will bring the same result.

Filter Unique Rows In Google Sheets - Example

Filter Unique Columns In Google Sheets

To filter unique columns, we were using the TRANSPOSE with UNIQUE in Google Sheets.

I have written a tutorial explaining that combo use here – How to Use UNIQUE Function in Horizontal Data Range in Google Sheets.

Now, we don’t want to depend on that combination.

Take the second formula above and change the value in the second argument (first optional argument), i.e., by_column, to TRUE. It will be as follows.

=UNIQUE(B2:D5,true,false)
Filter Unique Columns In Google Sheets - Example

As I have mentioned above, we can follow an alternative method that involves TRANSPOSE and UNIQUE as below.

=transpose(unique(TRANSPOSE(B2:D5)))

We don’t require to use this alternative solution now.

Filter Distinct Columns or Rows In Google Sheets

In the above two examples, we have experimented with the first optional argument (second argument).

I mean, we have tested the two Boolean values (TRUE/FALSE) in the second argument. In simple terms, use FALSE to filter unique by row and TRUE to filter unique by columns.

Here is the syntax once again for your quick reference: UNIQUE(range, [by_column], [exactly_once])

I hope you are now well familiar with the first two arguments. Here is the last one.

To get distinct columns or rows in Google Sheets, you need to use the Boolean TRUE in the last optional argument.

Formula in Cell F2:

=unique(B2:D5,false,true)

Formula in Cell F6:

=unique(B2:D5,true,true)
Filter Distinct Columns or Rows In Google Sheets - Example

If you don’t want to filter distinct columns or rows, don’t use the last argument or use FALSE.

I hope you could understand unique rows or columns and its difference from distinct rows or columns.

That’s all. Thanks for the stay. Enjoy!

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Sum by Quarter in Excel: New and Efficient Techniques

Knowing how to sum by quarter is crucial in Excel because quarterly reporting has...

Sum By Month in Excel: New and Efficient Techniques

Suppose you prefer to sum by month in Excel using a formula. In that...

How to Create An In-Cell Progress Bar in Excel

In-cell progress bars in Excel refer to bars that are within a cell, not...

Sum by Week Number in Excel (Dynamic Array Formula Included)

To sum by week number, we'll utilize the WEEKNUM, UNIQUE, and SUMIF functions in...

More like this

Count Distinct Values in Google Sheets Pivot Table

There is a built-in function for counting distinct values in a Google Sheets Pivot...

Conditional Formatting for Pivot Tables in Google Sheets

Do you know how to dynamically restrict conditional formatting within the Pivot Table area...

XLOOKUP in Merged Cells in Google Sheets

In Google Sheets, merging cells is not a good idea if you intend to...

2 COMMENTS

  1. Hello Prasanth,

    Info Inspired has been a great aid to my learning, thank you. I have a question if you do not mind?

    How can I filter distinct values from one column?

    From a list of emails, I want to be able to view the emails that appear only once.

    Any emails that appear 2 or more times I would like to remove. This is probably quite simple but I just can’t work it out!

    Thanks in advance.

    Tom.

    • Hi, Tom Symmons,

      Please see the first formula under the subtitle “Filter Distinct Columns or Rows In Google Sheets”

      Eg.

      Assume you have the email list in A2:A.

      So the formula to return the distinct email IDs will be;

      In B2

      =unique(A2:A,false,true)

      To make the emails unique, you can try this one.

      In C2

      =unique(A2:A)

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.