+ Reply to Thread
Results 1 to 3 of 3

Thread: Counting wild card string while filtering for a certain date range

  1. #1
    Registered User
    Join Date
    09-23-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    Unhappy Counting wild card string while filtering for a certain date range

    Hi,

    I want to know how I can calculate the number of times a particular text string appears in a column within a set date range...

    e.g.
    Column A
    01/08/2011
    05/08/2011
    19/08/2011
    23/08/2011
    11/09/2011
    14/09/2011
    20/10/2011

    Column B
    premium photo book
    A4 canvas print
    classic photo book
    glossy photo book
    new photo book
    poster print
    small photo book

    I now want to count the number of times the words "photo book" appear in August (01/08/2011 - 31/08/2011)

    In this case it would be 3 as the words "photo book" only appear 3 times in August (imagine column B is next to column A)

    Thanks in advance for any help!

  2. #2
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: Counting wild card string while filtering for a certain date range

    Based on your version (2003)

    Assuming always looking at complete month:

    =SUMPRODUCT((TEXT(A1:A100,"mmyyyy")="082011")*ISNUMBER(SEARCH("photo book",B1:B100)))
    If partial month:

    =SUMPRODUCT((A1:A100>=DATE(2011,8,1))*(A1:A100<=DATE(2011,8,15))*ISNUMBER(SEARCH("photo book",B1:B100)))
    obviously the hard wired constants can be altered to be cell references which contain parameter values

    NOTE: sumproduct is inefficient, should be used in moderation, ideally in non-volatile context and precedent ranges should be kept as lean as possible

    If you are using this exclusively in XL2007 or above then revert to COUNTIFS from SUMPRODUCT:

    =COUNTIFS(A:A,">="&DATE(2011,8,1),A:A,"<="&DATE(2011,8,31),B:B,"*photo book*")
    Note here size of precedent range is irrelevant hence use of A:A

  3. #3
    Registered User
    Join Date
    09-23-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Counting wild card string while filtering for a certain date range

    Thank you for the reply!

    I'm a bit lost, what exactly do I need to change in the code you gave me?

    I'm using excel 2010. How exactly do you get the two columns to relate to one another?

    In my case I have a column with dates in it and next to it is the column with the product description,

    Thanks again!

+ Reply to Thread

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