+ Reply to Thread
Results 1 to 7 of 7

Complex Count query I think?!

  1. #1
    Registered User
    Join Date
    02-14-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    12

    Complex Count query I think?!

    a 1 2 0 4 5
    b 1 2 3 0 5
    a 0 0 3 4 5
    b 1 2 3 4 0
    a 1 2 0 0 0


    what I am trying to achieve is, if column A = "a" then count the number of items that do not equal 0, in this case the answer should be 9 (4 from first line, 3 from 3rd, and 2 from the 5th line)

    driving me mad im sure its something simple.

    Many thanks

  2. #2
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Complex Count query I think?!

    How about:

    Please Login or Register  to view this content.
    Cheers,
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  3. #3
    Registered User
    Join Date
    02-14-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Complex Count query I think?!

    worked like a charm, thanks

  4. #4
    Forum Contributor
    Join Date
    01-30-2011
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    604

    Re: Complex Count query I think?!

    Macro solution:


    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-14-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Complex Count query I think?!

    i have been trying to enhance the formula to take a wildcard. i.e. if 'a' appears in the cell count it but it doesnt like it any suggestions?

    abc 1 2 0 4 5
    b 1 2 3 0 5
    afgd 0 0 3 4 5
    b 1 2 3 4 0
    aqw 1 2 0 0 0

    in this case i want to search for where a appears?

    =SUMPRODUCT((A1:A5="*a*")*(B1:F5<>0))

    i tried this but it returns 0. in the case above i would want it to return the same answer 9

  6. #6
    Registered User
    Join Date
    02-14-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Complex Count query I think?!

    =SUMPRODUCT(ISNUMBER(FIND("a",A1:A5))*(B1:F5<>0))

    solved it :D thanks

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Complex Count query I think?!

    The only thing that I could get to work was too late
    Last edited by newdoverman; 04-04-2014 at 03:44 PM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Complex ADODB-query
    By ino_mart in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-28-2012, 05:41 PM
  2. re: complex query
    By khalid79m in forum Excel General
    Replies: 2
    Last Post: 12-28-2006, 08:33 PM
  3. complex query
    By khalid79m in forum Excel General
    Replies: 2
    Last Post: 12-28-2006, 08:28 PM
  4. Complex query question
    By Stacy in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 AM
  5. [SOLVED] Complex query question
    By Stacy in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM

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