+ Reply to Thread
Results 1 to 12 of 12

COUNTIF/SUMPRODUCT range problems

  1. #1
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    136

    COUNTIF/SUMPRODUCT range problems

    Hi All,

    I have text (staff names) in ranges E92:E123 & E131:E133. At times not all of the cells in these ranges are populated with names. I need to count all the cells that have entries, duplicates only once, and leave the formula cell empty when the ranges are not populated. However, I am having great trouble combining the ranges into the COUNTIF formula.

    This works but does not combine both ranges:
    Please Login or Register  to view this content.
    I have tried:
    Please Login or Register  to view this content.
    which results in too few arguments. I have tried many other combinations for combining the ranges in the formula but am left scratching my head.

    How do I combine the ranges?

    Many thanks,
    Last edited by L plates; 12-21-2014 at 04:56 PM. Reason: Correct title
    Dave C

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: COUNTIF/SUMPRODUCT range problems

    Suggest you post a sample workbook.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    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
    52,939

    Re: COUNTIF/SUMPRODUCT range problems

    hard to say without seeing a sample, but perhaps...

    A
    B
    1
    aa
    6
    2
    bb
    3
    cc
    4
    aa
    5
    cc
    6
    dd
    7
    ee
    8
    aa
    9
    title1
    10
    title2
    11
    aa
    12
    ff

    =SUMPRODUCT(1/COUNTIF(A1:A12,A1:A12))-2
    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

  4. #4
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    136

    Re: COUNTIF/SUMPRODUCT range problems

    I've attached a sample cut from the worksheet. I hope this explains better.

    =SUMPRODUCT((E92:E123<>"")/(COUNTIF(E92:E123,E92:E123&"")) works but does not include the range E121:E134.

    I don't know how to include the second range in the formula to be counted as one range.

    Thanks,
    Attached Files Attached Files

  5. #5
    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
    52,939

    Re: COUNTIF/SUMPRODUCT range problems

    Try this...
    =SUMPRODUCT((E92:E133<>"")/COUNTIF(E92:E133,E92:E133&""))-COUNTA(E124:E130)

  6. #6
    Forum Contributor
    Join Date
    12-23-2003
    Posts
    179

    Re: COUNTIF/SUMPRODUCT range problems

    In E10 of the relevant sheet of your file, control+shift+enter, not just enter:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    136

    Re: COUNTIF/SUMPRODUCT range problems

    Thanks very much FDibbins & Aladin. Aladin, your formula did the trick! Is there a way for cell A10 to be empty "" when the result is 0. I tried using your formula in an IF function but received an error.

    p.s. what form of function uses braces?

    Many thanks,

  8. #8
    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
    52,939

    Re: COUNTIF/SUMPRODUCT range problems

    Try this...
    =IF(COUNTA(E92:E133)=0,"",SUMPRODUCT((E92:E133<>"")/COUNTIF(E92:E133,E92:E133&""))-COUNTA(E124:E130))

    {} are generally used to denote ARRAY formulas. This is a copy from the link below. If you google excel array, you will find many more...
    An array formula is a formula that can perform multiple calculations on one or more of the items in an array. Array formulas can return either multiple results or a single result. For example, you can place an array formula in a range of cells and use the array formula to calculate a column or row of subtotals. You can also place an array formula in a single cell and then calculate a single amount. An array formula that resides in multiple cells is called a multi-cell formula, and an array formula that resides in a single cell is called a single-cell formula.
    https://support.office.com/en-ca/art...2-ecfd5caa57c7

  9. #9
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    136

    Re: COUNTIF/SUMPRODUCT range problems

    Thanks FDibbins, thats perfect and a little easier for me to work out also. Thanks also for the snippet on array formulas. Very helpful!

    Regards,

  10. #10
    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
    52,939

    Re: COUNTIF/SUMPRODUCT range problems

    Happy to help, and thanks for the feedback

  11. #11
    Forum Contributor
    Join Date
    12-23-2003
    Posts
    179

    Re: COUNTIF/SUMPRODUCT range problems

    @L plates

    The FREQUENCY formula is faster:
    http://www.mrexcel.com/forum/excel-q...que-count.html

    Although 0 sounds more natural, for a blank...

    Control+shift+enter, not just enter:
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    136

    Re: COUNTIF/SUMPRODUCT range problems

    Hi Aladin,

    Thank you for your second solution. It does the job and as your link proves, is faster. I agree that 0 does sound more natural but it did not fit with the format of the worksheet in this application. I look forward to understanding array formulas!

    Many thanks,

+ 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] Countif problems
    By m.rigby55 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2014, 06:02 AM
  2. COUNTIF - Problems specify the criteria as a range
    By palmbum in forum Excel General
    Replies: 3
    Last Post: 01-16-2012, 07:10 AM
  3. CountIf Problems
    By kennedyJason in forum Excel General
    Replies: 3
    Last Post: 07-12-2011, 09:53 AM
  4. countif problems...
    By moshmoshon in forum Excel General
    Replies: 2
    Last Post: 07-28-2007, 02:01 AM
  5. [SOLVED] Countif problems
    By Sony in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-24-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