Return number of unique records from multiple criteria

stevemc2

New Member
Joined
Mar 1, 2013
Messages
11
Hello

I have a list of records that also contains various fields - and I should like to try and determine the number of unique references in one column based on criteria entered in others. Hopefully I can explain the requirements and can interpret this table to explain the result I would expect - assuming the table below is in cells A1 to F26.

If the criteria was
AREA = 106; TYPE = E or TYPE = X; LOCATION = Stockport; DATE is between 01/01/2010 and 31/12/2010 and INCLUDE = Y

then I am looking for the unique number of references returned in column F.
I think the answer should be 2 - being one record of NDEIBKN and two records of NDAAUYB.

Thanks for any assistance

AREATYPELOCATIONDATEINCLUDEREFERENCE
106EFiley30/04/2008NCZHCWM
106EKirkby29/11/2007YLCEGXBM
106EFiley30/11/2005NGEEXWX
106EStockport08/07/2010YNDAAUYB
106EStockport01/03/2010NJAZVVX
106EStockport01/03/2007NXZGUWR
106EKirkby27/01/2010YNDEIZTZ
106EFlint01/09/2009YYGEIFWH
106XStockport04/12/2010YNDEIBKN
106EStockport20/05/2009KUZIKHD
106EKirkby03/03/2004PNZDLLR
106WStockport25/10/2010YNAFZDXL
106EKirkby11/01/2007NCFGULN
106WStockport25/10/2010NAFZDXL
106ENewtown24/01/2002NGEAWDA
106XStockport30/11/2005NDEENPC
106EKirkby15/09/2006LGFGUTY
106EFiley30/05/2007BJZGOOY
106EKirkby30/06/2008BLZHKWH
106EKirkby29/11/2007YLCEGXBM
106EFlint01/09/2009YYGEIFWH
106XStockport08/07/2010YNDAAUYB
104EStockport01/03/2010YNJAZVVX
106EStockport01/03/2007YNXZGUWR
105EKirkby27/01/2010YNDEIZTZ

<tbody>
</tbody>
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi stevemc2,


I got this from Pivot table. Try it and Enjoy. Also donot forget to convert date into MM/DD/YYYY
DATE
REFERENCE
AREA
TYPE
LOCATION
INCLUDE
7/8/2010
NDAAUYB106E Stockport Y
X Stockport Y
3/1/2010NJAZVVX104E Stockport Y
106E Stockport (blank)
1/27/2010NDEIZTZ105E Kirkby Y
106
E Kirkby Y
12/4/2010NDEIBKN106X Stockport Y
10/25/2010NAFZDXL106W Stockport Y
(blank)
Grand Total


<col span="2"><col><col span="2"><col><col span="6"><tbody>
</tbody>

Regards,


Ishan


 
Upvote 0
Thanks Ishan

I did mean to say (but forgot before posting) that I was hoping for a formula to give me the results. Would you (or anyone else) know how to do it this way?
 
Upvote 0
Hey Thanks for writing!

You can use the following Formula assuming that your data is A1:F26, change the refrence as per the requirement:

=SUM(IFERROR(1/COUNTIF(F2:F26,IF((A2:A26=J1)*((B2:B26=K2)+(B2:B26=J2))*(C2:C26=J3)*(D2:D26>=J4)*(D2:D26<=K4)*(E2:E26=J5)=0,0,F2:F26)),0))

Put the velues in the following cells so that you can make the criteria dynamic:

J1 = 106
J2 = E
J3 = Stockport
J4 = 1/1/2010
J5 = Y
K2 = X
K4 = 31/12/2010

Also make sure you press Control+Shift+Enter while entering the formula since its an array operation.

Hope this helps.

Thanks/Raj
 
Upvote 0
Raj

Thanks very much that looks to have worked - and as I want to use it with dynamic data anyway even better. I will now try and further the formula to meet the requirements of the larger table that I have.
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

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