+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    07-20-2009
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    1

    Question Row count, for multiple criteria, with string search.

    Problem: I need to count rows where col1 has "Cow" and col2 has "Milk" (in the spreadsheet below)
    I am have written this formula, but the result is inaccurate (expected=3, actual=1).

    =SUMPRODUCT(('Sheet 1'!B2:B300="Cow")*('Sheet 1'!G2:G300="Milk"))

    Sample spreadsheet:

    Cow Milk
    Calf Cheese
    Cow and Calf Milk, Cheese
    Calf Cheese, Milk
    Cow and Calf Milk


    It looks like the exact word is matched. I've tried adding the wild character *, like "Cow*", but it doesn't work. What's missing here?? (I am not an excel programmer ) )

  2. #2
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,163

    Re: Row count, for multiple criteria, with string search.

    Try

    =SUMPRODUCT(ISNUMBER(SEARCH("cow",'Sheet 1'!B2:B300))*ISNUMBER(SEARCH("milk",'Sheet 1'!G2:G300)))
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0