A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
The following formula correctly calculates the number of UNIQUE entries in the range K4:K38.
=SUM(IF(FREQUENCY(K4:K38,K4:K38)>0,1))
I would like to add a parameter so that the range being evaluated is limited to rows where the data in column P is equal to a specific cell reference. The cell reference is a name of a region, so the formula would be evaluating the number of unique records in the sheet specific to that region.
I tried the formula below (entered as an array formula) and the result was not correct:
{=SUM(IF($P$4:$P$38=$B121,FREQUENCY($K$4:$K$38,$K$4:$K$38)>0,1))}
How can I modify the working formula so that I can limit the evaluated rows to rows where P matches my criteria?
Thanks,
David
See if this helps.
A1:A20 = region
B1:B20 = numeric values
Count the unique numeric values by the region that's entered in cell D1.
| North | 2 | North | |
|---|---|---|---|
| South | 2 | ||
| South | 1 | ||
| South | 5 | ||
| North | 2 | ||
| South | 2 | ||
| South | 3 | ||
| North | 5 | ||
| North | 4 | ||
| North | 1 | ||
| South | 1 | ||
| North | 3 | ||
| North | 4 | ||
| South | 5 | ||
| North | 3 | ||
| North | 5 | ||
| South | 3 | ||
| North | 5 | ||
| North | 2 | ||
| South | 1 |
Array entered** :
=SUM(IF(FREQUENCY(IF(A1:A20=D1,B1:B20),IF(A1:A20=D1,B1:B20)),1))
Result = 5
** array formulas need to be entered using the key combination of CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT key then hit ENTER.
Assumes no empty cells in column B.
--
Biff
Microsoft Excel MVP