Count range values but not duplicates

trimiii

Board Regular
Joined
May 15, 2018
Messages
69
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have the challenge to find the correct formula for the following:

I am currently using=COUNTIFS('KNK K Project'!A:A, {"BENZ"}, 'KNK K Project'!O:O, {"<=9"}) which it works for the total count.

So column "A:A" is my vehicle brand (Benz), and the column "O:O" are days open for service order. Now in column "C:C" I have the service work order number which has duplicates (because of awaiting parts and maybe one service order is listed 4 times).

What I am struggling with is, to find the formula to count my total number of the service order is listed in column "C:C", if criteria is "BENZ" (column "A;A"), with value <=9 (column "O:O") but not to count the duplicates in column "C:C"

Thoughts...
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Thoughts...
... update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version.
 
Upvote 0
Hi Peter, thank for note and I updated the data and I am currently using:
Product information:
Microsoft Office ProPus
 
Upvote 0
hi trimiii,
take a supporting column and check for duplicate in column C:C, if there is no duplicate in supporting column the put your count formula
 
Upvote 0
Hi vmjan02

Can you help me with the correct formula, please?

This is what I am using for the total count...
=COUNTIFS('KNK K Project'!A:A, {"BENZ"}, 'KNK K Project'!O:O, {"<=9"})
 
Upvote 0
I updated the data and I am currently using:
Product information:
Microsoft Office ProPus
OK, thanks. If your version of 365 has the FILTER & UNIQUE functions, then try something like the following.
I think is is best to avoid whole column references as some functions take that literally and try to calculate 1,000,000+ rows when often only a few hundred or few thousand rows are actually being used.
I have allowed for 1000 rows below but you adjust to be reasonable for the amount of data you are actually expecting.

trimiii 2020-03-11 1.xlsm
ABC
1
23
Sheet1
Cell Formulas
RangeFormula
B2B2=COUNT(UNIQUE(FILTER('KNK K Project'!C2:C1000,('KNK K Project'!A2:A1000="Benz")*('KNK K Project'!O2:O1000<=9))))


The above formula is counting the green rows below and excluding the blue duplicates.

trimiii 2020-03-11 1.xlsm
ACO
1
2Benz16
3Audi214
4Benz15
5Audi37
6Benz17
7Benz212
8Benz28
9Audi311
10Benz21
11Porsche55
12Porsche66
13Audi75
14Benz89
15
KNK K Project
 
Upvote 0
Hi,

Checked my functions in excel and unfortunately, I don't have Unique and Filter functions because once I enter the formula I receive the message "That function isn't valid" (see picture attached).

Any other idea, please?
 

Attachments

  • Error message.JPG
    Error message.JPG
    13.2 KB · Views: 2
Upvote 0
I don't have Unique and Filter functions
Pity, but you may well have them within a few months - not sure of just when though.

Unfortunately, the alternative that I came up with without using a helper column (see cell C3) is a bit more long-winded. ;)

trimiii 2020-03-11 1.xlsm
ABCD
1
233
Sheet1
Cell Formulas
RangeFormula
B2B2=COUNT(UNIQUE(FILTER('KNK K Project'!C2:C1000,('KNK K Project'!A2:A1000="Benz")*('KNK K Project'!O2:O1000<=9))))
C2C2=COUNT(IF('KNK K Project'!A2:A1000="Benz",IF('KNK K Project'!O2:O1000<=9,IF(MATCH('KNK K Project'!A2:A1000&"|"&'KNK K Project'!C2:C1000&"|"&('KNK K Project'!O2:O1000<=9),'KNK K Project'!A2:A1000&"|"&'KNK K Project'!C2:C1000&"|"&('KNK K Project'!O2:O1000<=9),0)=ROW('KNK K Project'!A2:A1000)-ROW('KNK K Project'!A2)+1,1,""))))


If you are happy to use a helper column in 'KNK K Project' then try this.
Note that the helper column can be hidden once the formula has been entered & copied down.

trimiii 2020-03-11 1.xlsm
ABCOP
1
2Benz161
3Audi214 
4Benz15 
5Audi37 
6Benz17 
7Benz212 
8Benz281
9Audi311 
10Benz21 
11Porsche55 
12Porsche66 
13Audi75 
14Benz891
15
KNK K Project
Cell Formulas
RangeFormula
P2:P14P2=IF(COUNTIFS(A$2:A2,"Benz",C$2:C2,C2,O$2:O2,"<=9")=1,1,"")


trimiii 2020-03-11 1.xlsm
D
1
23
Sheet1
Cell Formulas
RangeFormula
D2D2=COUNT('KNK K Project'!P2:P1000)
 
Last edited:
Upvote 0
Wow, this works just fine, thanks a lot and appreciate your assistance and support.
 
Upvote 0

Forum statistics

Threads
1,225,136
Messages
6,183,067
Members
453,147
Latest member
Lacey D

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