+ Reply to Thread
Results 1 to 10 of 10

Sum, Countif, and Array nested function help

  1. #1
    Registered User
    Join Date
    10-02-2014
    Location
    New York, NY
    MS-Off Ver
    2010
    Posts
    8

    Sum, Countif, and Array nested function help

    Hello -

    I have two columns

    First column has:

    a
    b
    c
    d
    e
    f

    Second column has:

    a
    b
    z
    z
    z
    z

    Each column has 6 values. I'm trying to find a formula that will count the number of values that DO NOT overlap between the two.

    I used =SUM(COUNTIF(C4:C9, E4:E9)) as an array to count the number of values that do overlap, which is 2.

    But what is the formula for me to get 4, the number of values that don't overlap? I tried =SUM(COUNTIF(C4:C9, "<>E4:E9")) as an array but that didn't work.

    Any help would be appreciated. Thanks!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Sum, Countif, and Array nested function help

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-02-2014
    Location
    New York, NY
    MS-Off Ver
    2010
    Posts
    8

    Re: Sum, Countif, and Array nested function help

    Thanks. I think that only works if I write the number, such as 6. Is there no way to automate that? I won't be able to apply this formula to larger files where I won't be counting the number of rows...just simply want to know how many don't overlap.

    Does that make sense? I guess I don't understand why the syntax for not overlapping values is not similar to/as easy as for overlapping values.

  4. #4
    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: Sum, Countif, and Array nested function help

    Maybe this

    =COUNTA(C:E)/2-SUMPRODUCT(--(C4:C9=E4:E9))
    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

  5. #5
    Registered User
    Join Date
    10-02-2014
    Location
    New York, NY
    MS-Off Ver
    2010
    Posts
    8

    Re: Sum, Countif, and Array nested function help

    Wow, that works great! Thank you!

    Can you briefly explain the logic behind that please? You're counting all the values in those two columns then subtracting the values that equal each other in the columns?

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Sum, Countif, and Array nested function help

    Hi.

    When you say "overlap", what precisely do you mean?

    In your example, all 4 values which contribute to your desired result come from the same column. Is that how the problem should be defined, then?

    What if you had values such as:

    C4:C9: a, a, a, a, a, b
    E4:E9: a, c, d, e, f, g

    i.e 7 different values used in total, and AlKey's formula would here return a result of 5.

    However, if you are considering from the perspective of both columns' entries, then you could argue that the result should be 6, not 5, since b, c, d, e, f and g do not "overlap" into the other column.

    Regards
    Click * below if this answer helped

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

  7. #7
    Registered User
    Join Date
    10-02-2014
    Location
    New York, NY
    MS-Off Ver
    2010
    Posts
    8

    Re: Sum, Countif, and Array nested function help

    Ok I understand your question.

    I will be using this to compare a list of attendees from one year to the next.

    For example, my first column will have names:

    John
    Alan
    Brad
    Chris
    Kyle
    Zack

    My second column will have names for the following year:

    John
    Alan
    Brad
    Chris
    Keith
    Tom

    I want the formula to tell me that two people from last year did not return to the conference. There will not be the same name multiple times so I think Alkey's formula will work.

    Am I thinking about it right?

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Sum, Countif, and Array nested function help

    AlKey's formula will work, but only if the names of people who did attend in each of those years are placed within the same row of their respective columns, "facing each other", if you like.

    They are in the two examples you've so far given, but, if you can't always guarantee that, then you should use, e.g.:

    =COUNTA(C4:C9)-SUMPRODUCT(COUNTIF(E4:E9,C4:C9))

    Regards

  9. #9
    Registered User
    Join Date
    10-02-2014
    Location
    New York, NY
    MS-Off Ver
    2010
    Posts
    8

    Re: Sum, Countif, and Array nested function help

    That's so great, thank you!

    Thank you for clarifying the differences between the two formulas as well.

  10. #10
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Sum, Countif, and Array nested function help

    You're welcome!

+ 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] Nested Countif Function
    By DDM64 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-17-2013, 10:16 AM
  2. Nested IF function with COUNTIF
    By jad70 in forum Excel General
    Replies: 5
    Last Post: 02-06-2012, 06:17 AM
  3. nested countif function
    By gavster in forum Excel General
    Replies: 12
    Last Post: 11-20-2007, 10:41 AM
  4. Countif with nested function not working?
    By jshuatree in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 07-17-2006, 05:55 PM
  5. [SOLVED] Countif Function -Nested
    By Angi in forum Excel General
    Replies: 7
    Last Post: 05-04-2005, 03:06 PM

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