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.
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.
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’
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'"))
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
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.