Counting Unique Values with variables

Tauon

New Member
Joined
Apr 22, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I'm trying to count how many times unique values show in a column tied to a particular criteria. I need to count how many items a particular location has, but only count the item once even if it repeats over a range of dates:

Example
LocationCount of ValuesLocationValues
Store 1?Store 1Value 1
Store 2?Store 1Value 1
Store 3?Store 1Value 2
Store 1Value 2
Store 1Value 2
Store 2Value 1
Store 2Value 1
Store 2Value 2
Store 2Value 2
Store 2Value 2
Store 3Value 1
Store 3Value 1
Store 3Value 2
Store 3Value 2
Store 3Value 2
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi & welcome to MrExcel.
How about
+Fluff 1.xlsm
ABCDE
1LocationCount of ValuesLocationValues
2Store 12Store 1Value 1
3Store 22Store 1Value 1
4Store 32Store 1Value 2
5Store 1Value 2
6Store 1Value 2
7Store 2Value 1
8Store 2Value 1
9Store 2Value 2
10Store 2Value 2
11Store 2Value 2
12Store 3Value 1
13Store 3Value 1
14Store 3Value 2
15Store 3Value 2
16Store 3Value 2
Main
Cell Formulas
RangeFormula
B2:B4B2=ROWS(UNIQUE(FILTER($E$2:$E$16,$D$2:$D$16=A2)))
 
Upvote 0
In Excel 365 you can use this formula.
$scratch.xlsm
ABCDE
1LocationCount of ValuesLocationValues
2Store 13Store 1Value 1
3Store 22Store 1Value 1
4Store 32Store 1Value 2
5Store 1Value 2
6Store 1Value 3
7Store 2Value 1
8Store 2Value 1
9Store 2Value 2
10Store 2Value 2
11Store 2Value 2
12Store 3Value 1
13Store 3Value 1
14Store 3Value 2
15Store 3Value 2
16Store 3Value 2
Unique Count
Cell Formulas
RangeFormula
B2:B4B2=COUNTA(UNIQUE(IF($D$2:$D$16=A2,E2:E16,"")))-1
 
Upvote 0
Solution
Are you saying that mine didn't?
 
Upvote 0
In what way didn't it work?
 
Upvote 0
Ok. Glad you got a solution that worked.
 
Upvote 0
That's odd. I thought Fluff's solution was actually better than mine. I'm surprised it didn't work.

(BTW the "-1" in mine was to take into account that the array would include the null string as a counted value.)
 
Upvote 0

Forum statistics

Threads
1,215,261
Messages
6,123,939
Members
449,134
Latest member
NickWBA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top