Closed Thread
Results 1 to 4 of 4

Countif - No Adjacent Cells

  1. #1
    Forum Contributor
    Join Date
    11-22-2003
    Location
    Newport, Rhode Island
    MS-Off Ver
    Excel 365
    Posts
    158

    Countif - No Adjacent Cells

    Hello,

    Using Excel 2007

    In the following example I want to count the number of times a "4" shows up but just for the cells A1:D1 and A3:D3 (non adjacent cells). When I write the formula =countif(A1:D1,A3:D3,4) I receive an error.
    See attached sample.

    How can I write a countif formula for non adjacent cells?
    Any help would be appreciated.

    Michael
    Attached Images Attached Images

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Quote Originally Posted by windme
    Hello,

    Using Excel 2007

    In the following example I want to count the number of times a "4" shows up but just for the cells A1:D1 and A3:D3 (non adjacent cells). When I write the formula =countif(A1:D1,A3:D3,4) I receive an error.
    See attached sample.

    How can I write a countif formula for non adjacent cells?
    Any help would be appreciated.

    Michael
    Simplest way would be to just add another countif. i.e.
    Please Login or Register  to view this content.
    Rgds

  3. #3
    Forum Contributor
    Join Date
    11-22-2003
    Location
    Newport, Rhode Island
    MS-Off Ver
    Excel 365
    Posts
    158
    Thanks for your reply.

    What could I use if had like 50 or more different non adjacent cells? Is there a sorter, "simpler" formula?
    Thanks.

  4. #4
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211
    Try this:

    =SUM(COUNTIF(INDIRECT({"A1:D1","A3:D3"}),4))


    IF you count every odd rows then try this:

    =SUMPRODUCT((MOD(ROW(A1:D100),2)=1)*(A1:D100=4))
    Last edited by Teethless mama; 02-17-2008 at 03:05 PM.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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