+ Reply to Thread
Results 1 to 9 of 9

Countif and non adjacent cells range

  1. #1
    Registered User
    Join Date
    05-17-2007
    Posts
    3

    Countif and non adjacent cells range

    I have some numbers in cells A1:A10. I want to count the number of numbers that are greater than 7 in non adjacent cells (for example in A2, A4 and A6).
    I tried with the COUNTIF function but the function won't accept a range such as A2,A4,A6. It returns a #Value error for the range.
    How can I do counting with a condition in non adjacent cells?
    Thank you for your help.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    Hi,

    This isn't exactly what you want, but you may be able to adapt it to your needs.

    =COUNT(IF(ROW(A1:A10)=EVEN(ROW(A1:A10)),IF(A1:A10>7,A1:A10,""),""))

    This counts all the even rows in the range, if they're greater than 7

    It's an array formula, so enter with CTRL, SHIFT AND ENTER
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    05-17-2007
    Posts
    3
    Thank you Dave. In fact I was just using A2, A4 and A6 as an example. In reality, the cells I want to count from are not even, they really don't follow any pattern.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,792
    How many cells are involved? If it's a low number as per your example try

    =(A2>7)+(A4>7)+(A6>7)

    Otherwise, are they really random or are the cells you want to look at defined by some text in another column or something else?

  5. #5
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    I think this does it - can someone please check I'm not barking up the wrong tree here?

    =INDEX(FREQUENCY((range),max_value),2)

    eg.,

    =INDEX(FREQUENCY((A1,A4,A8,A12,C7,C6,C5),7),2)

    counts all the values in the specified cells greater than 7.

    Dave

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,792
    Looks good to me, Dave

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by sweep
    I think this does it - can someone please check I'm not barking up the wrong tree here?

    =INDEX(FREQUENCY((range),max_value),2)

    eg.,

    =INDEX(FREQUENCY((A1,A4,A8,A12,C7,C6,C5),7),2)

    counts all the values in the specified cells greater than 7.

    Dave
    I like that too
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  8. #8
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    Thanks Guys,

    Wood for the trees, y'know??

  9. #9
    Registered User
    Join Date
    05-17-2007
    Posts
    3
    Sweep's formula worked great for me! Thank you so much for your help.

+ Reply to 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