which returns 3, since three different people worked on on project Omega. Note: this is an array formula and must be entered with control + shift + enter. The result from MATCH is an array like this: Because MATCH always returns the position of the first match, values that appear more than once in the data return the same position. For example, because “Jim” appears 4 times in the list, he shows up in this array 4 times as the number 1. Outside of MATCH function, the IF function is used to apply criteria, which in this case involves testing if the project is “omega” (from cell G5): The IF function acts like a filter, only allowing the values from MATCH to pass through if they are associated with “omega”. The result is an array like this: The filtered array is delivered directly to the FREQUENCY function as the data_array argument. Next, the ROW function is used to build a sequential list of numbers for each value in the data: This creates an array like this: which becomes the bins_array argument in FILTER. At this point, we have: FREQUENCY returns an array of numbers that indicate a count for each value in the data array, organized by bin. When a number has already been counted, FREQUENCY will return zero. The result from FREQUENCY is an array like this: Note: FREQUENCY always returns an array with one more item than the bins_array. At this point, we can rewrite the formula like this: We check for values greater than zero, which converts the numbers to TRUE or FALSE: Then we use a double-negative to coerce the logical values to 1s and 0s: Finally, the SUM function returns 3 as the final result. Note: this is an array formula and must be entered using Control + Shift + Enter.

### Handling empty cells in the range

If any cells in the range are empty, you’ll need to adjust the formula to prevent empty cells from being passed into the MATCH function, which will throw an error. You can do this by adding another nested IF function to check for blank cells:

### With two criteria

If you have two criteria, you can extend the logic of the formula by adding another nested IF: Where c1 = criteria1, c2 = criteria2 and vals = the values range.

### With boolean logic

With boolean logic, you can reduce nested IFs: This makes it easier to add and manage additional criteria. Note: I adapted the formulas above from Mike Givin’s excellent book on array formulas, Control-Shift-Enter.

### UNIQUE function in Excel 365

In Excel 365, the UNIQUE function provides a better, more elegant way to list unique values and count unique values. These formulas can be adapted to apply logical criteria.

### Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.