+ Reply to Thread
Results 1 to 6 of 6

Need help with counting occurance for multiple people at once

  1. #1
    Registered User
    Join Date
    04-01-2015
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    10

    Need help with counting occurance for multiple people at once

    Hi excel forum,
    Im new here, and would need some advice and help with my database problem.

    Data:
    Name Year
    Tom 2013
    Tom 2014

    Tom 2015
    Tom 2015
    Mike 2012
    Mike 2012

    (Space is intentional as there are cases which have such occurance, where there are blank entries)
    I need a formula which could help me count the number of years that occurances did happen for each person,
    And each year should only be count once.
    I had one previously:
    =sumproduct((P2:P500<>"")/countif(p2:p500,p2:p500&""))

    But this only works for single person at any one time.
    I would require one that allow me to chek multiple entries at once.

    Do help and thankyou for your help
    Have a nice day!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need help with counting occurance for multiple people at once

    This is an array formula, so you must limit how many cells you put this formula into as arrays are intense resource hogs.

    Assuming:
    1) Names are in P2:P500
    2) Years are in Q2:Q500
    3) You have already extracted the unique list of names using Data > Filter from column P and put them into a column ready for calculation, let's say this unique list is starting at Y2
    4) This array formula in Z2 will provide the first answer:

    =SUM(IF(FREQUENCY(IF($P$2:$P$500=Y2, $Q$2:$Q$500), IF($P$2:$P$500=Y2, $Q$2:$Q$500)) > 0, 1))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    Once the first correct answer appears, copy Z2 down as far as your unique list of names in column Y.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    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: Need help with counting occurance for multiple people at once

    Or you can continue with your SUMPRODUCT formula

    =SUMPRODUCT((P$2:P$500<>"")*(P$2:P$500=N4)/COUNTIF(Q$2:Q$500,Q$2:Q$500&""))

    Row\Col
    M
    N
    O
    P
    Q
    3
    Count Unique Names Name Year
    4
    3
    Tom Tom
    2013
    5
    1
    Mike Tom
    2014
    6
    7
    Tom
    2015
    8
    Tom
    2015
    9
    Mike
    2012
    10
    Mike
    2012
    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

  4. #4
    Registered User
    Join Date
    04-01-2015
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    10

    Re: Need help with counting occurance for multiple people at once

    Quote Originally Posted by AlKey View Post
    Or you can continue with your SUMPRODUCT formula

    =SUMPRODUCT((P$2:P$500<>"")*(P$2:P$500=N4)/COUNTIF(Q$2:Q$500,Q$2:Q$500&""))

    Row\Col
    M
    N
    O
    P
    Q
    3
    Count Unique Names Name Year
    4
    3
    Tom Tom
    2013
    5
    1
    Mike Tom
    2014
    6
    7
    Tom
    2015
    8
    Tom
    2015
    9
    Mike
    2012
    10
    Mike
    2012

    I tried this
    But it gave me tom as 5.506122
    And mike as 0.5

  5. #5
    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: Need help with counting occurance for multiple people at once

    Do you see the correct results?

    Please see attached file
    Attached Files Attached Files

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need help with counting occurance for multiple people at once

    The array option:
    Attached Files Attached Files

+ 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. [SOLVED] Counting event occurance
    By PomDave in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-31-2014, 10:56 PM
  2. [SOLVED] Counting An Occurance Of A Value
    By monkeyman90210 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-19-2012, 06:45 AM
  3. Counting Occurance
    By lazyme in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-25-2007, 03:01 PM
  4. Occurance Counting
    By Rusty in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-06-2006, 08:20 AM
  5. Counting occurance of text values across multiple worksheets
    By Jiq in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-22-2006, 11:25 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