+ Reply to Thread
Results 1 to 15 of 15

Formula that counts unique values within a criteria

  1. #1
    Registered User
    Join Date
    11-03-2013
    Location
    lebanon
    MS-Off Ver
    Excel 2007
    Posts
    8

    Formula that counts unique values within a criteria

    Hi Guys,

    i am trying to count the # of unique items bought by each customer by month.
    i have the customer codes in first column , item codes in 2nd column and monthly sales.

    i am attaching my excel file. can you please help me figure out what would be the easiest formula here ?? (knowing that the report is very long!)
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    11-03-2013
    Location
    lebanon
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Formula that counts unique values within a criteria

    for example, if you filter to customer # 334, you will find that he bought 25 unique items in Jan 2013 (excluding zero sales). how can i get that result (25) in a formula??? Helpppp

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Formula that counts unique values within a criteria

    Have a look at the attached for one way to do it.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-03-2013
    Location
    lebanon
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Formula that counts unique values within a criteria

    thanks alot for the help! cheers

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Formula that counts unique values within a criteria

    No problem. Happy to help.

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Formula that counts unique values within a criteria

    Or you can also use this

    =SUMPRODUCT(($C$5:$C$8138=$Q5)*(--(E$5:E$8138>0)))

    Drag formula across and down.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  7. #7
    Registered User
    Join Date
    11-03-2013
    Location
    lebanon
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Formula that counts unique values within a criteria

    Hi guys,
    i've reviewing the formulas you sent me but they're not excluding duplicate item codes value.

    i am attaching a single customer code #622 that has bought duplicate items in Jan 2013. i want the result to show me only the number of UNIQUE items bought. if i use your formula, the result would be 136 items (which is taking into consideration the item repeated more than once) the result i need for unique items bought should be 91 unique items any views on how to do the formula???
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-03-2013
    Location
    lebanon
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Formula that counts unique values within a criteria

    the new example of customer # 622 is in "GR NEW" file.

  9. #9
    Registered User
    Join Date
    11-03-2013
    Location
    lebanon
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Formula that counts unique values within a criteria

    hello?? help need to submit the report tomorrow...

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Formula that counts unique values within a criteria

    Would this be what you are looking for?
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  11. #11
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Formula that counts unique values within a criteria

    Hi,

    a pivot table could be a great help

    In R2

    =SUM(IF(ISNUMBER(1/FREQUENCY(IF($C$5:$C$8138=Q5,IF($E$5:$E$8138<>0,MATCH($D$5:$D$8138,$D$5:$D$8138;0))),ROW($A$5:$A$8138)-4)),1))


    array formula to be confirmed with control+shift+enter

    Regards
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Formula that counts unique values within a criteria

    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  13. #13
    Registered User
    Join Date
    11-03-2013
    Location
    lebanon
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Formula that counts unique values within a criteria

    Thanks alot CANAPONE! finally this is what i needed.

    can i ask you on another note why did u use ROW A although it's empty...?

  14. #14
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Formula that counts unique values within a criteria

    ROW($A$5:$A$8138) creates a range of numbers from 5 to 8138
    5,6,7.......8136,8137,8138
    but the formula needs 1 to 8134 as thats how many rows between $E$5:$E$8138
    so subtract 4
    ROW($A$5:$A$8138)-4 = 1,2,3,4,.....8132,8133,8134
    canopone could have used row(a1:a8134) instead or even row(z1:z8134) its all the same
    Last edited by martindwilson; 11-03-2013 at 01:22 PM.

  15. #15
    Registered User
    Join Date
    11-03-2013
    Location
    lebanon
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Formula that counts unique values within a criteria

    thanks Martin, very helpful...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Counts unique values per dates
    By albert28 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-07-2013, 06:10 AM
  2. Unique formula that also counts non-unique once
    By jvbeats in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-19-2013, 02:38 PM
  3. User-defined function, counts unique with criteria
    By cdiaz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-12-2011, 04:18 PM
  4. How to get unique counts from large data by formula
    By irfan.rangrej in forum Excel General
    Replies: 5
    Last Post: 08-30-2011, 07:39 AM
  5. Counts of unique values with multiple criteria
    By ChristiaanV in forum Excel General
    Replies: 4
    Last Post: 03-09-2011, 12:47 AM

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