+ Reply to Thread
Results 1 to 13 of 13

Count number of cells based on 2 selections in the same range.

  1. #1
    Forum Contributor
    Join Date
    02-27-2009
    Location
    Chennai, India
    MS-Off Ver
    Excel 2013
    Posts
    327

    Count number of cells based on 2 selections in the same range.

    Count a cell to another cell based on two selections.

    B1 & B2 are 2 dropdown boxes taking their inputs from a same range. When both are selected, how to count between them.

    example worksheet is attached.
    Attached Files Attached Files
    Last edited by jilaba; 02-15-2010 at 11:04 AM. Reason: query had mistakes
    Ask me how to hate XL.

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Count number of cells based on 2 selections in the same range.

    If B1 selection is Master (27) & B2 is Stars (3) : the difference is 4.
    In my book that is 24 ??

    8-(4*7)=20/9=2 & 1 Remainder
    Again 20/9 = 2 & 2 (18 & 2) remainder ??
    Last edited by rwgrietveld; 02-15-2010 at 09:52 AM.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  3. #3
    Forum Contributor
    Join Date
    02-27-2009
    Location
    Chennai, India
    MS-Off Ver
    Excel 2013
    Posts
    327

    Re: Count number of cells based on 2 selections in the same range.

    You are right. The remainder 2 should match the good, fair list (result range) and B3 should show BAD as result.

    thanks.
    Last edited by DonkeyOte; 02-15-2010 at 09:57 AM. Reason: quote removed

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Count number of cells based on 2 selections in the same range.

    ... and the diff between B1 & B2.

    here is something straight forward.

    Result: =VLOOKUP(MOD(8-SQRT((VLOOKUP($B1,$M:$N,2,FALSE)-VLOOKUP($B2,$M:$N,2,FALSE))^2)*7,9),$J$3:$K$10,2,FALSE)

  5. #5
    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

    Re: Count number of cells based on 2 selections in the same range.

    Hi, Your worked example doesn't look correct.

    First of all if B1 = Master - value 27, and B2 = stars - value 3, the difference is 24 and not 4 as you say.

    Secondly 20 divided by 9 = 18 remainder 2 and not 1 as you say.

    Thirdly you mention two constants, 8 & 7. What about the 9 value, is that a constant too?

    Would you clarify?

    Rgds
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  6. #6
    Forum Contributor
    Join Date
    02-27-2009
    Location
    Chennai, India
    MS-Off Ver
    Excel 2013
    Posts
    327

    Re: Count number of cells based on 2 selections in the same range.

    Buttrey :

    Thanks.
    I mentioned it. It is mere counting from cell to cell. "Count number of cells based on 2 selections in the same range."
    Remainder is 2 only. I am very weak in calculations and xl
    9 is also a constant.

    I changed the query.xls example attachement.
    Last edited by jilaba; 02-15-2010 at 10:14 AM. Reason: explanation

  7. #7
    Forum Contributor
    Join Date
    02-27-2009
    Location
    Chennai, India
    MS-Off Ver
    Excel 2013
    Posts
    327

    Re: Count number of cells based on 2 selections in the same range.

    Quote Originally Posted by rwgrietveld View Post
    ... and the diff between B1 & B2.

    here is something straight forward.

    Result: =VLOOKUP(MOD(8-SQRT((VLOOKUP($B1,$M:$N,2,FALSE)-VLOOKUP($B2,$M:$N,2,FALSE))^2)*7,9),$J$3:$K$10,2,FALSE)
    Will try this and let u know. Thanks.

  8. #8
    Forum Contributor
    Join Date
    02-27-2009
    Location
    Chennai, India
    MS-Off Ver
    Excel 2013
    Posts
    327

    Re: Count number of cells based on 2 selections in the same range.

    The sample file itself having some mistakes. I corrected the mistakes and uploaded again. If someone can solve it, will be thankful.

  9. #9
    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

    Re: Count number of cells based on 2 selections in the same range.

    Hi,

    I still can't reconcile your calculation. master is indeed as you say the 27th row, but Stars is the 3rd row. Isn't that a difference of 24 and not 4?

    Assuming the above is correct then one way is:

    Please Login or Register  to view this content.
    HTH

  10. #10
    Forum Contributor
    Join Date
    02-27-2009
    Location
    Chennai, India
    MS-Off Ver
    Excel 2013
    Posts
    327

    Re: Count number of cells based on 2 selections in the same range.

    Buttrey, thanks again.

    Master is in 27th row. BUT, it is the count starting point "1". After 27th, First row, Second row, Third row. So total 4 rows. 4 is the answer for that part, not 24. Hope its clear now.

    Since what you assumed is contrary to what i meant, your solution is not working.
    Last edited by jilaba; 02-15-2010 at 12:16 PM. Reason: update

  11. #11
    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

    Re: Count number of cells based on 2 selections in the same range.

    Hi,

    It wasn't clear that this was a sort of circular referencing system. One way is
    Please Login or Register  to view this content.
    HTH

  12. #12
    Forum Contributor
    Join Date
    02-27-2009
    Location
    Chennai, India
    MS-Off Ver
    Excel 2013
    Posts
    327

    Re: Count number of cells based on 2 selections in the same range.

    RButtrey: Thanks.

    Yes i missed to mention its circular ref. I will try your solution and come back.

  13. #13
    Forum Contributor
    Join Date
    02-27-2009
    Location
    Chennai, India
    MS-Off Ver
    Excel 2013
    Posts
    327

    Re: Count number of cells based on 2 selections in the same range.

    RButtrey : Thanks.

    Still something is wrong. Better, i will try little more and rewrite my example file, then start a new thread.

+ 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