+ Reply to Thread
Results 1 to 7 of 7

DCOUNT with multiple criteria

  1. #1
    Registered User
    Join Date
    07-26-2010
    Location
    Mexico City
    MS-Off Ver
    Excel 2010
    Posts
    4

    DCOUNT with multiple criteria

    Hi,

    I have a worksheet, 10 columns (A to J), and + 500 rows, first row are headers, the rest are integer numbers between 1 and 70, no specific order, I can say random.

    M1 M2 M3 M4 M5 M6 M7 .....M10
    10 17 21 50 54 56 37
    17 18 19 24 37 53 50
    7 8 26 27 53 56 20
    9 10 24 32 35 55 34
    4 9 27 31 33 40 45
    15 17 38 41 46 54 21
    10 19 20 23 31 44 38
    1 5 10 13 31 54 46
    9 37 38 42 50 56 6
    6 27 37 41 50 53 18
    8 16 24 42 46 50 28
    11 28 29 31 49 54 19
    19 27 29 35 37 44 24
    ....

    What I need to do is get occurrence between all of them, something like this:

    1 2 3 4 5 6 7 8 9 10 11....
    1 0 0 0 0 0 0 0 0 0 0 0
    2 0 0 0 0 0 0 0 0 0 0 0
    3 0 0 0 0 0 0 0 0 0 0 0
    4 0 0 0 0 0 0 0 0 0 0 0
    5 0 0 0 0 0 0 0 0 0 0 0
    6 0 0 0 0 0 0 0 0 0 0 0
    7 0 0 0 0 0 0 0 0 0 0 0
    8 0 0 0 0 0 0 0 0 0 0 0
    9 0 0 0 0 0 0 0 0 0 0 0
    10 0 0 0 0 0 0 0 0 0 0 0
    11 0 0 0 0 0 0 0 0 0 0 0
    .....

    The table should tell me how many "1" and "2", "1" and "3"... "1" and "70" all the way to "70" and "68", "70" and "69" occurrences are in the data list (M1...M10).
    I'm using DCOUNT formula, in an array, it has 70 columns and 70 rows.
    The table above shows 0's since the formula I used is not working as desired, criteria seems to be the problem..

    Any ideas?... your help will be really appreciated.

    Thank you.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: DCOUNT with multiple criteria

    For the sake of efficiency I would suggest you do something along the lines of:

    Please Login or Register  to view this content.
    Your matrix results are then very basic and fast calculations

    Assume for sake of example:

    -- your source values (and above calc) is on sheet called Data
    -- results matrix occupies is on sheet called Results
    -- results matrix range is A1:BS71 [1 to 70 in B1:BS1 and A2:A71]
    The calcs for A2:BS71 are basic COUNTIF functions utilising the key column and wildcards

    Please Login or Register  to view this content.
    the above uses prior results as and when applicable (eg 1 & 10 / 10 & 1 are the same so need only conduct the slightly slower COUNTIF once)

    I tested the above on a data set of 1000+ rows and matrix calculation time was approx. 0.6 second

    (You may need to modify formulae above based upon your own locale delimiter - ie ; if not , )
    Last edited by DonkeyOte; 07-27-2010 at 02:55 AM. Reason: added note re: delimiter

  3. #3
    Registered User
    Join Date
    07-26-2010
    Location
    Mexico City
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: DCOUNT with multiple criteria

    Thank you DonkeyOte for your help,

    I tried what you suggest, but something is not right, I got the table filled with 0's.

    Pls see attached file, this is a smaller file, less rows and less columns... but the procedure should be the same.

    Your help will be really appreciated.
    Attached Files Attached Files
    Last edited by xvicman; 07-28-2010 at 02:20 PM.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: DCOUNT with multiple criteria

    The formula suggested is not an Array.

    To correct your sample file ...

    Highlight your matrix B2:BS71 - selecting B2 first - hit F2 and then press CTRL + ENTER
    (this will re-enter all of the formulae whilst removing the Array)

  5. #5
    Registered User
    Join Date
    07-26-2010
    Location
    Mexico City
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: DCOUNT with multiple criteria

    Thank you again bud,

    I saw where I was screwing it, did what you suggested and seems to work, but something is not right, there are several occurrences that the formula is not counting, most likely the ones with bigger numbers.

    BTW, the data set sent doesn´t includes numbers greater than 56, so those occurrences are expected to be 0's, but there are others, like 50-54-56 as in the first row of Data that doesn't appear in the count table (M_CT).

    Please see attached file.

    Again, your help is really appreciated.

    Regards.
    Attached Files Attached Files

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: DCOUNT with multiple criteria

    Error on my part - there is a wildcard missing in the COUNTIF (prior to first pipe).

    The formula for B2 should read:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-26-2010
    Location
    Mexico City
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: DCOUNT with multiple criteria

    Bud....

    Thank you.... Thank you.... Thank you....

    It works just perfect!!!.

    Thank you very much indeed.

    Regards.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1