![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Fort Lauderdale
Posts: 338
|
column A contains Order ID#s with many duplicates
column b contains criteria #1 with many duplicates column c contains criteria #2 with many duplicats Example A.....B.....C..... 10G...RED...Circle 10G...RED...Circle 10G...Green.Circle 10G...BLUE..Circle 11B...RED...Circle 11B...RED...Circle 11B...Pink..Triangle 11B...BLUE..Square 12C...BLUE..Square 12C...BLUE..Circle 12C...Green.Triangle 12C...RED...Square 13D...Green.Circle 14E...Pink..Square 15F...Red...Triangle 16G...Blue..Triangle I have to pull unique ID#s of only RED or Blue Circles and Red or Blue Squares. I need a formula to give 3 as the result with the above data. This is for a worksheet with 42000+ rows and 40 columns. I tried to do it with a pivot table but it gave every occurance of the ID# not unique ID#s. I got my number once by sorting and deleting "shapes" then "colors" then finally using Advanced Filter to copy unique ID#s for what remained into another column the just "COUNTA"ing them, but I need to do this on a regular basis so that method is less than ideal. Any help appreciated!!!!!!! |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Define an Advanced filter for that. You could also record a macro while you're at it, to make it faster the next times.
|
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Millbank, London, UK
Posts: 1,790
|
=SUMPRODUCT((B2:B40001={"red","blue"})*(C2:C40001="circle"))+SUMPRODUCT((B2:B40001={"red","blue"})*(C2:C40001="square"))
I suspect this can be shortened... also, if you notice performance degredation, I'd suggest also trying =DCOUNT
__________________
:: Pharma Z - Family drugstore :: |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Mhmm... I'm confused now... do you need only the number ? or the list ?
|
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
Here's an array formula that I think does what you want.
Code:
=count(IF(($A2:$A=A1)*($B2:$B10=B1)*($C2:$C10=C1),$D:$D)) A1 = value looking for in colA B1 = "" "" "" Colb C1 = "" "" "' colc 1)Note ranges can be changed to what ever you need. And A1-B1-C1 can be changed to another cell in other columns 2)All rows need to be same length 3)Last thing is that you need to enter the number one in the d column so that the column of 1's is same length as the other's [ This Message was edited by: Nimrod on 2002-05-15 16:30 ] [ This Message was edited by: Nimrod on 2002-05-15 16:33 ] |
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Use the DCOUNTA function
With your data in cells A1:C17, and criteria range as F1:G2 -- where F1 houses Color, G1 houses Shape, and in cells F2 and G2 you key in the color and shape of interest ID Color Shape 10G RED Circle 10G RED Circle 10G Green Circle 10G BLUE Circle 11B RED Circle 11B RED Circle 11B Pink Triang 11B BLUE Square 12C BLUE Square 12C BLUE Circle 12C Green Triang 12C RED Square 13D Green Circle 14E Pink Square 15F Red Triang 16G Blue Triang then the following formula =DCOUNTA($A$1:$C$17,2,F1:G2) gives me 4 for Red and Circle gives me 1 for REd and Square gives me 2 for Blue and Circle gives me 2 for Blue and Square Hope This Helps Regards! _________________ Yogi Anand Edit: Deleted inactive web site reference from hard code signature line [ This Message was edited by: Yogi Anand on 2003-01-19 17:10 ] |
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Use the DCOUNTA function
With your data in cells A1:C17, and criteria range as F1:G2 -- where F1 houses Color, G1 houses Shape, and in cells F2 and G2 you key in the color and shape of interest if you need to include the ID number in the criteria, expand the criteria to range E1:G2, where E1 houses ID Regards! |
|
|
|
|
|
#9 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
Aladin |
|
|
|
|
|
|
#10 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Finally an answer... I did read the post again to notice that ! anyway, thanks Aladin.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|