+ Reply to Thread
Results 1 to 4 of 4

Nested COUNTIF in SUM formula

  1. #1
    Registered User
    Join Date
    10-16-2019
    Location
    Stafford, England
    MS-Off Ver
    Office 2013, Office 365
    Posts
    2

    Exclamation Nested COUNTIF in SUM formula

    I am using the following to be able to count the number of unique texts within a column.

    {=SUM(1/COUNTIF(C4:C792,C4:C792))}

    I would like the above formula to include the range C4:C872 instead of C4:C792, but due to the fact that C793:C872 are blank cells the output of the formula becomes #DIV/0!

    Is there anyway that I can edit the above formula so that it does not give this error but includes the range with the blank cells?

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Nested COUNTIF in SUM formula

    Hello and welcome to the forum.

    Try this:

    =SUM(IF(C4:C872<>"",1/COUNTIF(C4:C872,C4:C872))) Ctrl Shift Enter

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Nested COUNTIF in SUM formula

    edit: too slow... ;-)

    adjust numerator and append 2nd range with ""

    {=SUM((C4:C872<>"")/COUNTIF(C4:C872,C4:C872&""))}

    or

    =SUMPRODUCT((C4:C872<>"")/COUNTIF(C4:C872,C4:C872&""))

    latter doesn't require Array entry - but no more efficient.

  4. #4
    Registered User
    Join Date
    10-16-2019
    Location
    Stafford, England
    MS-Off Ver
    Office 2013, Office 365
    Posts
    2

    Re: Nested COUNTIF in SUM formula

    Thank you both. :D i have used =SUMPRODUCT((C4:C875<>"")/COUNTIF(C4:C875,C4:C875&""))

    as i keep forgetting to do CTRL SHIFT ENTER afterwards

+ 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. Help understanding a nested IF(COUNTIF formula
    By carlito2002wgn in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-29-2019, 07:12 PM
  2. [SOLVED] Nested COUNTIF and IF Formula
    By neurion in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-04-2015, 05:34 AM
  3. [SOLVED] Need Help with nested COUNTIF formula
    By Mark_12345 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-10-2014, 01:31 PM
  4. [SOLVED] Nested?, Countif function or sumproduct formula, please need a tip
    By david gonzalez in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-23-2014, 11:44 PM
  5. [SOLVED] Trouble with nested IF-COUNTIF Formula
    By Ford Sakata in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-10-2013, 01:45 PM
  6. COUNTIF & IF mixed/nested formula help
    By Nick.C in forum Excel General
    Replies: 15
    Last Post: 01-31-2012, 08:13 PM
  7. help on a nested countif/nested if formula
    By vickiemc in forum Excel General
    Replies: 2
    Last Post: 08-13-2008, 08:29 AM

Tags for this Thread

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