Counting Unique Cells based on 2 values in other columns

ultracyclist

Active Member
Joined
Oct 6, 2010
Messages
271
Office Version
  1. 365
Platform
  1. Windows
Hi,

I need help with a formula. I’m counting unique cells in Column B and want to add criteria that looks column J for the value of 21 and Column K for Hardware. If both criteria match the unique value, it will count.

Here’s two formulas that I’ve tried with no luck

=COUNTA(UNIQUE(B16:B972,$J:$SJ="21","*Hardware*",K:K))

=SumIF (Unique(B2:B900),($J:$J='21'),($K:$K='Hardware')

Network Budget-SDWAN-Meraki-11-1-Master Final.xlsx
BCDEFGHIJK
1Site CodePurchase YearCost Type
2COLB21Hardware
3COLB21Software
4COLB
5COLB
6COLB
7COLB
8COLI21Hardware
9COLI21Software
10COLI
11PITA21Hardware
12PITA21Software
13PITA
14PITA
15LOED21Hardware
16LOED21Software
17LOED
US Switch Replacements(Master)
Cells with Data Validation
CellAllowCriteria
J1List=$Q$2:$Q$3
J2:J17List=$O$2:$O$7
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I changed the cell format to a number and tried the same formulas, but the results are the same. Using this formula it returns a value of 1. Based on my sample data I should see a value of 4
 
Upvote 0
in formula change from "21" or '21' to 21 only

=COUNTA(UNIQUE(B16:B972,$J:$SJ="21","*Hardware*",K:K))
=SumIF (Unique(B2:B900),($J:$J='21'),($K:$K='Hardware')
 
Upvote 0
I tried it again with your suggested changes, but it's still not working.
 
Upvote 0
Can you try entering the formula in the sample data sheet I created to see if it works and repost?

Thanks,
 
Upvote 0
and no , I can't test your formula
but imho it should be
=COUNTA(UNIQUE(B16:B972,$J:$SJ=21,"*Hardware*",K:K))
=SumIF (Unique(B2:B900),($J:$J=21),($K:$K='Hardware')
 
Upvote 0
unqsynt.png

unq.png
 
Upvote 0
I created a new Excel document and copied the data to see if something was corrupt when I copied the formulas.

When I used this formula- =COUNTA(UNIQUE(B2:B972,$J:$SJ=21,"*Hardware*",K:K)) in Cell C19 it still returns a value of 1. It should indicate 4 to match the unique values in Column B.

Book1
ABCDEFGHIJK
1Site CodePurchase YearCost Type
2COLB21Hardware
3COLB21Software
4COLB
5COLB
6COLB
7COLB
8COLI21Hardware
9COLI21Software
10COLI
11PITA21Hardware
12PITA21Software
13PITA
14PITA
15LOED21Hardware
16LOED21Software
17LOED
18
191
Sheet1
Cell Formulas
RangeFormula
C19C19=COUNTA(UNIQUE(B2:B972,$J:$SJ=21,"*Hardware*",K:K))


Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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