Blog
>
Tutorials

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

2 Minutes

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

Tired of constantly monitoring your spreadsheets? Scale operations with Lido automations and free up time to focus on what really matters.