+ Reply to Thread
Results 1 to 14 of 14

get count for range greater than another

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    cairo
    MS-Off Ver
    Excel 2010
    Posts
    17

    get count for range greater than another

    I've 2 set of ranges contains numbers A1:A5 , B1:B5

    I want to get count for number of A cells greater than B cells
    meanining

    count(if A1 > B1 and A2>B2 and ....)

    thanks

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: get count for range greater than another

    Try this
    =SUMPRODUCT(--(B1:B5>A1:A5))

    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Contributor CheshireCat's Avatar
    Join Date
    10-11-2011
    Location
    Victoria, Canada
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    258

    Re: get count for range greater than another

    Try this:

    Please Login or Register  to view this content.
    Docendo discimus.

  4. #4
    Registered User
    Join Date
    08-17-2012
    Location
    cairo
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: get count for range greater than another

    this gives me True or False

    I need count for nuber of A cells that are greater than B cells

    what is -- mean?

    Thanks alot

  5. #5
    Forum Contributor CheshireCat's Avatar
    Join Date
    10-11-2011
    Location
    Victoria, Canada
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    258

    Re: get count for range greater than another

    The "--" is called a double unary. It changes the TRUE/FALSE to 1/0. If you remove it, you will get TRUE/FALSE.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,164

    Re: get count for range greater than another

    Hi besbesmany and welcome to the forum,

    Find the attached for an answer. I think Ron is backwards and the smiling cat got the > sign correct. The double dash of -- is called a unary and makes sure the stuff that comes back is a number. It is like doing a negative of a negative.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  7. #7
    Registered User
    Join Date
    08-17-2012
    Location
    cairo
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: get count for range greater than another

    i get True and when i remove -- i get false

    there is no 1/0 at all

    anyway how to get count number for larger cells

  8. #8
    Forum Contributor CheshireCat's Avatar
    Join Date
    10-11-2011
    Location
    Victoria, Canada
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    258

    Re: get count for range greater than another

    Ron isn't "backwards"! Only the > in his formula is.


  9. #9
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,164

    Re: get count for range greater than another

    Are you sure? He has B>A and could have done a communtative and made it A>B or flipped the sign and made it B<A or done both and got it wrong twice with A<B. All said and done - Ron may be backwards!?

    Let's see if he defends himself. Better yet he could edit his post so it shows the correct answer.

    I wonder if the OP will respond now?

  10. #10
    Registered User
    Join Date
    08-17-2012
    Location
    cairo
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: get count for range greater than another

    Thanks alot , the attachement file is working as i want
    Love this forum really

  11. #11
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: get count for range greater than another

    Quote Originally Posted by MarvinP View Post
    .... All said and done - Ron may be backwards!?
    Hey....are you guys talking about me?
    I don't *think* I'm backwards. Nope, I just turned around and I'm still facing forwards. But, when I do that alot, I get dizzy and fall down...so be careful if you try it, OK?

  12. #12
    Forum Contributor CheshireCat's Avatar
    Join Date
    10-11-2011
    Location
    Victoria, Canada
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    258

    Re: get count for range greater than another

    @besbesmany - Happy to help.

    @MarvinP - Point conceded; I am not "sure". Apparently he gets dizzy and falls down alot.

  13. #13
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,164

    Re: get count for range greater than another

    I have a Windows Phone and when I shake it my Avitar falls down.

    See the demo at http://cnettv.cnet.com/windows-phone...-50091820.html

    I don't think my Avatar knows the GT from LT or < from > after he gets up.

  14. #14
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: get count for range greater than another

    Besbesmany,

    It looks like your problem has been solved. This time, i will mark it [SOLVED] for you. Next time please ensure you do it for your threads.

    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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