Unique with Filter : Formula issue

chandrashekar

Well-known Member
Joined
Jul 15, 2005
Messages
517
Office Version
  1. 365
Platform
  1. Windows
Hello,

am trying below formula to get unique count based on multi criteria but am getting wrong count.

Can you please let me know where is error.

=IFERROR(ROWS(UNIQUE(FILTER(Sheet1!M2:M59039,(Sheet1!B2:B59039<>"HD")*(Sheet1!AH2:AH59039=1)*(Sheet1!AM2:AM59039="CH")*IFERROR(Sheet1!AL2:AL59039="First",0)+IFERROR(Sheet1!AL2:AL59039="Second",0)+IFERROR(Sheet1!AL2:AL59039="Three",0)))),0)

Regards,
Chandrashekar B
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
What about a small set of sample dummy data (say about 20 rows) with XL2BB and tell us
- what the expected result is
- why that is the expected result.

With XL2BB, hide all the irrelevant columns before making your Mini Sheet
 
Upvote 0
Hello,

am trying below formula to get unique count based on multi criteria but am getting wrong count.

Can you please let me know where is error.
=IFERROR(ROWS(UNIQUE(FILTER(Sheet1!M2:M59039,(Sheet1!B2:B59039<>"HD")*(Sheet1!AH2:AH59039=1)*(Sheet1!AM2:AM59039="CH")*IFERROR(Sheet1!AL2:AL59039="First",0)+IFERROR(Sheet1!AL2:AL59039="Second",0)+IFERROR(Sheet1!AL2:AL59039="Three",0)))),0)

Issue with below statement where am trying to add multi condition as below
IFERROR(Sheet1!AL2:AL59039="First",0)+IFERROR(Sheet1!AL2:AL59039="Second",0)+IFERROR(Sheet1!AL2:AL59039="Three",0)

However it is working with first condition as below
=IFERROR(ROWS(UNIQUE(FILTER(Sheet1!M2:M59039,(Sheet1!B2:B59039<>"HD")*(Sheet1!AH2:AH59039=1)*(Sheet1!AM2:AM59039="CH")*IFERROR(Sheet1!AL2:AL59039="First",0)))),0)

Regards,
Chandrashekar B
 
Upvote 0
What about a small set of sample dummy data (say about 20 rows) with XL2BB and tell us
- what the expected result is
- why that is the expected result.

With XL2BB, hide all the irrelevant columns before making your Mini Sheet
Hello Peter,

Cannot share data as it is confidential but am trying explain in detail.

Hello,

am trying below formula to get unique count based on multi criteria but am getting wrong count.

Can you please let me know where is error.
=IFERROR(ROWS(UNIQUE(FILTER(Sheet1!M2:M59039,(Sheet1!B2:B59039<>"HD")*(Sheet1!AH2:AH59039=1)*(Sheet1!AM2:AM59039="CH")*IFERROR(Sheet1!AL2:AL59039="First",0)+IFERROR(Sheet1!AL2:AL59039="Second",0)+IFERROR(Sheet1!AL2:AL59039="Three",0)))),0)

Issue with below statement where am trying to add multi condition as below
IFERROR(Sheet1!AL2:AL59039="First",0)+IFERROR(Sheet1!AL2:AL59039="Second",0)+IFERROR(Sheet1!AL2:AL59039="Three",0)

However it is working with first condition as below
=IFERROR(ROWS(UNIQUE(FILTER(Sheet1!M2:M59039,(Sheet1!B2:B59039<>"HD")*(Sheet1!AH2:AH59039=1)*(Sheet1!AM2:AM59039="CH")*IFERROR(Sheet1!AL2:AL59039="First",0)))),0)

Regards,
Chandrashekar B
 
Upvote 0
Cannot share data as it is confidential
That is why I said ..
What about a small set of sample dummy data

It is very difficult to know why you are not getting the results that you expect without sample data. That is particularly so when it seems to me to be working.

Here is my dummy sample data. I have marked green all the rows that meet the basic criteria and I have marked blue the unique values in those green rows.

chandrashekar.xlsm
BMAHALAM
1H2H13H34H38H39
2HDa1FirstCH
3PQb1FirstCH
4HDc1FirstCH
5PQd1FirstCH
6PQs1FirstCH
7FFa1FirstCH
8HDs1FirstCH
9GGd1FirstCH
10HDc1FirstCH
11GGb1FirstCH
12ABd5FirstCH
13ABs2FirstCH
14AAx1SecondCH
15AAy1ThreeCH
16AAs1FirstXX
17AAd2FirstXX
18AAc2FirstXX
19AAv2FirstXX
20AAf1FirstXX
Sheet1


Here is your formula from post 1. It seems to me to be giving the correct result.

chandrashekar.xlsm
A
16
Sheet2
Cell Formulas
RangeFormula
A1A1=IFERROR(ROWS(UNIQUE(FILTER(Sheet1!M2:M59039,(Sheet1!B2:B59039<>"HD")*(Sheet1!AH2:AH59039=1)*(Sheet1!AM2:AM59039="CH")*IFERROR(Sheet1!AL2:AL59039="First",0)+IFERROR(Sheet1!AL2:AL59039="Second",0)+IFERROR(Sheet1!AL2:AL59039="Three",0)))),0)


So, if that is correct for me but not for you is is hard to determine what the issue is for you without seeing something else.
 
Upvote 0
That is why I said ..


It is very difficult to know why you are not getting the results that you expect without sample data. That is particularly so when it seems to me to be working.

Here is my dummy sample data. I have marked green all the rows that meet the basic criteria and I have marked blue the unique values in those green rows.

chandrashekar.xlsm
BMAHALAM
1H2H13H34H38H39
2HDa1FirstCH
3PQb1FirstCH
4HDc1FirstCH
5PQd1FirstCH
6PQs1FirstCH
7FFa1FirstCH
8HDs1FirstCH
9GGd1FirstCH
10HDc1FirstCH
11GGb1FirstCH
12ABd5FirstCH
13ABs2FirstCH
14AAx1SecondCH
15AAy1ThreeCH
16AAs1FirstXX
17AAd2FirstXX
18AAc2FirstXX
19AAv2FirstXX
20AAf1FirstXX
Sheet1


Here is your formula from post 1. It seems to me to be giving the correct result.

chandrashekar.xlsm
A
16
Sheet2
Cell Formulas
RangeFormula
A1A1=IFERROR(ROWS(UNIQUE(FILTER(Sheet1!M2:M59039,(Sheet1!B2:B59039<>"HD")*(Sheet1!AH2:AH59039=1)*(Sheet1!AM2:AM59039="CH")*IFERROR(Sheet1!AL2:AL59039="First",0)+IFERROR(Sheet1!AL2:AL59039="Second",0)+IFERROR(Sheet1!AL2:AL59039="Three",0)))),0)


So, if that is correct for me but not for you is is hard to determine what the issue is for you without seeing something else.
Hello Peter,

Issue with adding multi condition however it is working fine with single condition. I have added sample data and not getting expected result.

Sample data: Sample data
 
Upvote 0
Thanks for the sample data. But shouldn't the answer be 10, as marked blue? (I've marked green all cells that meet the criteria this time)

Book8.xlsx
ABCDE
1Column1Column2Column3Column4Column5
2IECT11SecondCH
3KESSCT21SecondSH
4KESSCT31SecondCH
5KESSCT41SecondCH
6MylifeCT51FirstCH
7MylifeCT61FirstSH
8MylifeCT71FirstCH
9MylifeCH11FirstCH
10KESSCT81SecondCH
11MylifeCH21FirstCH
12MylifeCH21FirstCH
13MylifeCH21FirstCH
14MylifeCH31FirstCH
15MylifeCH31FirstCH
16MylifeCH31FirstCH
17MylifeCH41FirstCH
18MylifeCH41FirstCH
19MylifeCT91#N/ACH
20KESSCH51SecondSH
Sheet1


I believe what is missing (& was from the original too) is parentheses around the 'multiple conditions' section

=IFERROR(ROWS(UNIQUE(FILTER(Sheet1!B2:B20,(Sheet1!A2:A20<>"HD")*(Sheet1!C2:C20=1)*(Sheet1!E2:E20="CH")*(IFERROR(Sheet1!D2:D20="First",0)+IFERROR(Sheet1!D2:D20="Second",0))))),0)
 
Upvote 0
=IFERROR(ROWS(UNIQUE(FILTER(Sheet1!B2:B20,(Sheet1!A2:A20<>"HD")*(Sheet1!C2:C20=1)*(Sheet1!E2:E20="CH")*(IFERROR(Sheet1!D2:D20="First",0)+IFERROR(Sheet1!D2:D20="Second",0))))),0)
Hello Peter,
Thanks a lot now it is working fine.

Regards,
Chandrashekar B
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,824
Members
449,190
Latest member
rscraig11

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