+ Reply to Thread
Results 1 to 5 of 5

SUMPRODUCT using OR with two or more text strings

  1. #1
    Registered User
    Join Date
    11-10-2009
    Location
    Watkins Glen, NY
    MS-Off Ver
    Excel 2007/2003
    Posts
    48

    SUMPRODUCT using OR with two or more text strings

    =SUMPRODUCT(--(C:C="Jack")--(A:A>=DATE(2005,10,1)),--(A:A<=DATE(2005,12,31)))

    How can I modify this to look for Jack, or Hurley, or John, or Sawyer?

    Thanks a lot!
    Bryce
    Last edited by bkatzman; 04-01-2010 at 10:16 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: SUMPRODUCT using OR with two or more text strings

    Instead of "John" write some cell reference so you can change value of cell. For example D1:

    =SUMPRODUCT(--(C:C=D1),--(A:A>=DATE(2005,10,1)),--(A:A<=DATE(2005,12,31)))
    Never use Merged Cells in Excel

  3. #3
    Registered User
    Join Date
    11-10-2009
    Location
    Watkins Glen, NY
    MS-Off Ver
    Excel 2007/2003
    Posts
    48

    Re: SUMPRODUCT using OR with two or more text strings

    I'm not sure this would work for us. I want to use this function as part of a template that I can dump a lot of data (about 1k rows) that have differing dates in A,C

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: SUMPRODUCT using OR with two or more text strings

    Uplaod example workbook. Maybe a Pivot table is what you need.

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

    Re: SUMPRODUCT using OR with two or more text strings

    Quote Originally Posted by bkatzman
    How can I modify this to look for Jack, or Hurley, or John, or Sawyer?
    OR's are generally conducted via Addition in Arrays/Sumproducts, ie:

    =SUMPRODUCT((C:C="Jack")+(C:C="Sawyer")+(C:C="Hurley"),--(A:A>=DATE(2005,10,1)),--(A:A<=DATE(2005,12,31)))

    However, for multiple search terms it's often easiest to use an ISNUMBER based test:

    =SUMPRODUCT(--ISNUMBER(SEARCH(C:C,{"Jack","Sawyer","Hurley"})),--(A:A>=DATE(2005,10,1)),--(A:A<=DATE(2005,12,31)))


    Try to avoid using entire column references though... (pre XL2007 you can't)

+ 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.6.0 RC 1