In this article:

How to use UNIQUE IF in Google Sheets [2024 Update]

May 8, 2024

In this article we will show you how to create a formula using the Google Sheets UNIQUE IF function in just a few clicks. Simply follow the steps below.

How to use UNIQUE IF in Google Sheets

In this example we will identify the unique values in column A that correspond with the value ‘yes’ in column B and have the results generated in a separate column.

For the purpose of this demonstration an example data sheet was created. Click here to access the sheet and follow along at home.

1. Select an empty cell in your spreadsheet.

Click on an empty cell in your sheet, this will be where the results will populate. 

In our example we have highlighted cell D6 which is next to the data set and under the header of ‘Unique Results’

How to use Unique IF in Google Sheets: Select empty cell

2. Enter the formula =UNIQUE(QUERY(cellRef1:cellRef2 , "Cell column comparison = 'Cell Value'"))

In the empty cell, input the formula in the format of:  =UNIQUE(QUERY(Cell_ref1:Cell_ref2, "Cell column comparison= 'Cell Value'"))

Formula Breakdown:

UNIQUE: This function identifies and removes duplicate entities from a dataset or individual cell ranges.

QUERY: The Query function selects what to display and contains the parameters of the search 

CellRef1: This is the reference of the first cell you need to compare. (As an example - A3)

CellRef2: The reference of the second cell or range you need to compare. (As an example - B11), you can also check a range of cells by inputting a cell range here instead. (example - B3:B11).  

Cell column comparison: Compares values in specified columns and returns rows where a specified condition is true. 

In our example below It tells the QUERY() function to compare the values in columns A and B for each row in the range A3:B11 and only return the values from column A where the corresponding cell value (see below)  in column B is "yes".

Cell Value: The formula will return the result that is designated in this selection, for example ‘yes’ or ‘no’.

In our example, the formula will check the cell references in column A and B and if they equal the result of ‘yes’. Our example formula is: 

=UNIQUE(QUERY(A3:B11,"select A where B = 'yes'"))

Google Sheets using unique if: Enter formula

3. Press Enter to populate the results

With the formula inputted, simply press the Enter key. The formula will run and the results will populate.

In our example we checked if any cells in the data set in the B column returned ‘yes’, the returned results are the names that correspond with this result in column A

Using unique if in Google Sheets: Results

If you enjoyed this article, you might also like our article on how to set up the IF Not Error in Google Sheets or our article on how to use the MEDIAN IF in google sheets. 

If you want to learn how to extract names from email addresses in Google Sheets, we also suggest checking out our detailed guide. 

Get Google Sheets productivity and automation tips delivered straight to your inbox
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
We'll email you 1-3 times a week — and never share your information.
Get your copy of our free Google Sheets automation guide!
  • 27 pages of Google Sheets tips and tricks to save time
  • Covers pivot tables and other advanced topics
  • 100% free

Work less, automate more!

Use Lido to connect your spreadsheets to email, Slack, calendars, and more to automate data transfers and eliminate manual copying and pasting. View all use cases ->