+ Reply to Thread
Results 1 to 21 of 21

SUMPRODUCT with COUNTIF to find unique entries

  1. #1
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    SUMPRODUCT with COUNTIF to find unique entries

    Attached is a simulation file using SUMPRODUCT AND COUNTIF.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Customer ID : A2:A16
    Entries Month : B2:B16
    Lookup Month : F3

    Problem
    However if you look at the attached file, this formula does not return the correct answer.

    Current Solution
    I insert a new column (C) and to combine the text together.
    E.g. C2 = A2&B2

    Then I use the below formula,
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I got the correct result, but...

    Question
    Is it possible to have one formula instead of inserting a new column?

    I tried
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    All failed...

    Your advice would be greatly appreciated.
    Attached Files Attached Files
    Last edited by crzu; 11-09-2012 at 02:53 AM. Reason: Weird attachment is gone
    Click * to reward me...
    Thank you...

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,047

    Re: SUMPRODUCT with COUNTIF to find unique entries

    what are you actually trying to count?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    Re: SUMPRODUCT with COUNTIF to find unique entries

    @ FDibbins

    Sorry I left out my objective. It is to count the number of customers visiting in the month.

    As the example data show that customer "CN00062" visited twice in the month of May. So the formula is suppose to allow the calculation of unique entries.

    Probably you could see the above attached file for more details?

  4. #4
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    Re: SUMPRODUCT with COUNTIF to find unique entries

    bump.. anyone?

  5. #5
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    Re: SUMPRODUCT with COUNTIF to find unique entries

    Attached the file again.

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: SUMPRODUCT with COUNTIF to find unique entries

    Do you use Excel 2003, as your profile says?
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  7. #7
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    Re: SUMPRODUCT with COUNTIF to find unique entries

    @ Fotis1991

    Yes. My company, I am working in, is using Excel 2003.

    They also have no intention to upgrade. Haha.

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: SUMPRODUCT with COUNTIF to find unique entries

    I have an array formula for this but use COUNTIFS. For some unexpected reason, i am not able to convert this using SUMPRODUCT. I'll keep trying...

  9. #9
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    Re: SUMPRODUCT with COUNTIF to find unique entries

    Thanks Fotis1991.

  10. #10
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: SUMPRODUCT with COUNTIF to find unique entries

    An Array formula.

    =SUM(IF(FREQUENCY(IF(B2:B16=F3,IF(LEN(A2:A16)>0,MATCH(A2:A16,A2:A16,0),"")),IF(B2:B16=F3,IF(LEN(A2:A16)>0,MATCH(A2:A16,A2:A16,0),"")))>0,1))

  11. #11
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: SUMPRODUCT with COUNTIF to find unique entries

    Using your posted workbook,

    This ARRAY FORMULA, completed by holding down CTRL and SHIFT when you press ENTER (instead of just pressing ENTER), returns the count of unique Customer ID's for May
    Please Login or Register  to view this content.
    In your example, that formula returns: 4

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  12. #12
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    Re: SUMPRODUCT with COUNTIF to find unique entries

    Thanks Fotis and Ron. Is there anyway to solve this apart from using VBA and CSE formula? I used to use CSE Formula, but boss is not able to understand and thus I have to redo my work.

  13. #13
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: SUMPRODUCT with COUNTIF to find unique entries

    Your boss does not want helper columns, does not want CSE formula, not VBA..

    I think he must invented a new program or make strongly complaints to Microsoft for these...

  14. #14
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    Re: SUMPRODUCT with COUNTIF to find unique entries

    @ Fotis

    Haha. They like to micro manage. Therefore, if they can't understand, they won't use. Oh well, hope there is way to solve this.

  15. #15
    Registered User
    Join Date
    07-14-2011
    Location
    Ha Noi, Viet Nam
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: SUMPRODUCT with COUNTIF to find unique entries

    Try this :
    PHP Code: 
    =SUMPRODUCT((LEFT(aRR,LEN(F3))=F3)*(MATCH(aRR,aRR,0)=ROW(INDIRECT("1:"&ROWS(aRR))))) 
    Attached Files Attached Files

  16. #16
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: SUMPRODUCT with COUNTIF to find unique entries

    Or this

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    Re: SUMPRODUCT with COUNTIF to find unique entries

    Thanks jason.b75 and Sunflowers,

    Both of your formula work perfectly well. It is a new way of using the formula for me. I learn alot from these.

    Really thank you.

  18. #18
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    Re: SUMPRODUCT with COUNTIF to find unique entries

    @ jason.b75

    I did a simulation on the formula and found that if the CustomerID does not visit on the selected month. It will return as #N/A.

    Below is the attachment of the simulation.

    I could not figure out on how this below formula work. Appreciate if you could also share your understanding.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  19. #19
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: SUMPRODUCT with COUNTIF to find unique entries

    try:

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

  20. #20
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    Re: SUMPRODUCT with COUNTIF to find unique entries

    @ icestationzbra

    Thanks, both of your formula work.

    Mind if you could share on how the logic of the formula work?

    It would be great if we could understand the logic.

  21. #21
    Forum Contributor
    Join Date
    09-11-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2013
    Posts
    103

    Re: SUMPRODUCT with COUNTIF to find unique entries

    Thanks for all of your help. I will try to understand the formula, somehow.

    The formula are great. I would close this thread as solved.

+ 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