+ Reply to Thread
Results 1 to 6 of 6

Count if Value in Range 1 greater than value in Range 2

  1. #1
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Count if Value in Range 1 greater than value in Range 2

    Hi

    I have two ranges that show parts of a question to be answered and those parts already answered (aa6:aa55 and ab6:ab55). I would like to count those elements where the value in column AA is greater than the corresponding value in column AB, showing questions with parts still to be answered. Currently I have a formula comparing the two and am counting the occurrences of true or false. This seems to be overkill and I am sure that there is an array formula that can do the same thing more efficiently, unfortunately I cannot figure it out.

    Thanks for any help you can offer.

    Regards

    Jeff
    Last edited by solnajeff; 11-24-2009 at 08:37 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count if Value in Range 1 greater than value in Range 2

    Do you mean?

    =SUMPRODUCT(--(AA1:AA100>AB1:AB100))

    adjust ranges to suit.
    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.

  3. #3
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Count if Value in Range 1 greater than value in Range 2

    Hi

    Thanks for the help. I had tried using sumproduct, but did not have the double dash and it did not work. Could you please tell me what is the significance of this part?

    Thanks again

    Jeff

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count if Value in Range 1 greater than value in Range 2

    It, the double dash, is the double unary and is used to coerce Boolean output (True/False) to integer equiv. (1/0 respectively) - in this instance these Integer values are then simply summed.

    For more detailed info re: SUMPRODUCT and coercion see the link in my sig. to Bob Phillips' white paper.

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Count if Value in Range 1 greater than value in Range 2

    Jeff,

    this is called the double unary operator. It is used to turn boolean TRUE and FALSE into numeric 1 and 0 respectively, so the result can be used for a calculation.

    Watch the formula in the Evaluate Formula tool and see how it transforms

    --({TRUE,TRUE,FALSE,TRUE,FALSE,FALSE})

    into

    ({1,1,0,1,0,0})

    hth

  6. #6
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Count if Value in Range 1 greater than value in Range 2

    Hi

    Thanks a lot, now it makes sense to me, for the life of me I could not figure it out.

    Regards

    Jeff

+ 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