+ Reply to Thread
Results 1 to 4 of 4

Find a Substring in SUMPRODUCT Array

Hybrid View

  1. #1
    Registered User
    Join Date
    06-23-2010
    Location
    Pennsylvania, United States
    MS-Off Ver
    Excel 2008 for Mac
    Posts
    7

    Find a Substring in SUMPRODUCT Array

    Hi all,

    I'm working with this formula

    =SUMPRODUCT(--('all data'!$D$2:$D$501="All"),--('all data'!$E$2:$E$501=$A7),--('all data'!$G$2:$G$501=D$5))

    The problem is, sometimes D$5 is only a substring of a cell in 'all data'!$G$2:$G$501. How do I tell the formula to count all the times that D$5 appears in the specified range, either as the entirety of a cell's contents or as a substring within a cell?

    Substrings in cells in G2:G501 are separated by commas, so there is also the option to expand that single column into several columns. But changing the range to, say, 'all data'!$G$2:$K$501=D$5 returns an error. Also, this would require manual input to convert text to columns, and I'd like to keep this spreadsheet as automatic as possible (after copying and pasting items from a database into the 'all data' sheet for portability).

    Thanks!
    Last edited by MobiusTrip; 06-30-2010 at 09:58 PM. Reason: Solved

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Find a Substring in SUMPRODUCT Array

    Try:

    =SUMPRODUCT(--('all data'!$D$2:$D$501="All"),--('all data'!$E$2:$E$501=$A7),--(ISNUMBER(SEARCH(D$5,'all data'!$G$2:$G$501))))
    Where there is a will there are many ways.

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

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

  3. #3
    Registered User
    Join Date
    06-23-2010
    Location
    Pennsylvania, United States
    MS-Off Ver
    Excel 2008 for Mac
    Posts
    7

    Re: Find a Substring in SUMPRODUCT Array

    That works, thanks!

    As a side note, in case anyone runs into a similar problem in the future, I thought that I had tried that earlier (I searched around a bit before posting). It turns out that I had "...--ISNUMBER(..." instead of "...--(ISNUMBER(...". Big difference in results.

    Thanks again!

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Find a Substring in SUMPRODUCT Array

    Quote Originally Posted by MobiusTrip
    As a side note, in case anyone runs into a similar problem in the future, I thought that I had tried that earlier (I searched around a bit before posting). It turns out that I had "...--ISNUMBER(..." instead of "...--(ISNUMBER(...". Big difference in results.
    In reality I suspect there were other issues... the parentheses encasing the ISNUMBER are not technically required:

    =SUMPRODUCT(--('all data'!$D$2:$D$501="All"),--('all data'!$E$2:$E$501=$A7),--ISNUMBER(SEARCH(D$5,'all data'!$G$2:$G$501)))

    will work just the same.

+ 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