+ Reply to Thread
Results 1 to 7 of 7

Using COUNTIF function, Array formulas

  1. #1
    Registered User
    Join Date
    09-13-2018
    Location
    Charleston, WV
    MS-Off Ver
    2016
    Posts
    9

    Using COUNTIF function, Array formulas

    I have column E filled with a random assortment of 1s and 2s from E3:E34. I will be entering a random assortment of 1s and 2s into D3:D34. I want to take the cells in Column E that match the cells in Column D and sum them in E35. As of right now, I use an array formula that is as follows: {=COUNTIF(E3:E34,$D3:$D34)}. When I insert the formula into the E35, it totals the number of cells in column E that match D3, instead of checking each cell to see if it matches its counterpart in Column D. Is there something that I'm doing wrong? Thanks!

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

    Re: Using COUNTIF function, Array formulas

    You ask for SUM but you're using a COUNT function?

    =SUMPRODUCT(--(E3:E34=D3:D34))

    =SUMPRODUCT(--(E3:E34=D3:D34),E3:E34)

    Do either of those give the result you're looking for?

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Using COUNTIF function, Array formulas

    Use this normal formula:


    =SUMPRODUCT(--($D$3:$D$34=$E$3:$E$34))
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    09-13-2018
    Location
    Charleston, WV
    MS-Off Ver
    2016
    Posts
    9

    Re: Using COUNTIF function, Array formulas

    It was to my understanding that the COUNT function would be used for counting the number of cells that meet the criteria, and that the SUM function would sum the cell values. Could you explain what the difference is between the two functions please? Those formulas also did the trick, thanks!

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Using COUNTIF function, Array formulas

    If you were SUMMING matching pairs... a pair of 1s would count as 1 and a pair of 2s as two. You are counting matching pairs, whereby any matching pair counts as 1.

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

    Re: Using COUNTIF function, Array formulas

    Your understanding is correct, but this line quoted from your original question

    I want to take the cells in Column E that match the cells in Column D and sum them in E35.
    suggested that you wanted to sum the values, rather than count the number of matches.

    From the 2 formulas that I suggested, the first will count the matching rows, the second will sum the values that match.

  7. #7
    Registered User
    Join Date
    09-13-2018
    Location
    Charleston, WV
    MS-Off Ver
    2016
    Posts
    9

    Re: Using COUNTIF function, Array formulas

    Ah, I see where that would be confusing. Yeah, I wanted to count the matching rows, not sum their values. Regardless, your formula did the trick, so thank you!

+ 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. Function to work like a countif but looking in the formulas of cells as opposed to values
    By bottledbanks in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-13-2015, 09:50 AM
  2. Sum, Countif, and Array nested function help
    By lea334 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-02-2014, 12:10 PM
  3. IF and COUNTIF array formulas
    By Kevrhof in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-23-2014, 06:15 PM
  4. [SOLVED] WORKDAY function & array formulas { }
    By hhost in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-14-2013, 08:14 AM
  5. [SOLVED] Countif, mode function formulas doesnt work the way I wish it should be
    By moniquem in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-27-2013, 02:54 AM
  6. COUNTIF array function not working
    By Excellentafrican in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-25-2013, 03:53 AM
  7. Array Formulas Using the Sum Function
    By kingjams in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-22-2007, 02:47 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