In this article:

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

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. 

Use our deadline tracking software to easily track deadlines from your spreadsheet in just a few clicks. 

Automate repetitive tasks with Lido

Save hours on repetitive and tedious work. Lido is a new spreadsheet that connects your spreadsheets, forms, PDFs, and email inbox.

Trigger
Action
Select trigger
When a cell value in Google Sheets changes
Check Google Sheets for today's date
When a new row is added to Google Sheets
On new Google Form submission
Send me a daily reminder
On new Typeform submission
When a cell value in database changes
Check database for today's date
When a new row is added in database
When a new HubSpot customer is created
Select action
ADDCALENDAREVENT
Creates a one- or multiple-day calendar event with optional attendees
ADDHUBSPOT
Adds an object to Hubspot
ADDSLACKCHANNEL
Create a Slack channel, and optionally add a topic or members
CALLURL
Makes any HTTP request
CREATEGOOGLEDOC
Replaces [@column_name] values in a Google Doc with the corresponding table row's values
CREATEPDF
Replaces [@column_name] values in a Google Doc with the corresponding table row's values, then export it as a PDF
FETCH
Makes any HTTP request and returns the response
INSERTROWS
Inserts given array below defined values in given worksheet
SENDGMAIL
Sends an email using your Google account
SENDOUTLOOK
Sends an email using your Microsoft Outlook account
SENDSLACK
Sends a Slack message
SENDSMS
Sends an SMS message using your Twilio account
UPDATECELL
Updates cells with given values
UPDATEHUBSPOT
Updates a property of a Hubspot object
Trigger is required
Action is required
Get started