+ Reply to Thread
Results 1 to 8 of 8

SUMProduct with certain text string as a criteria

  1. #1
    Registered User
    Join Date
    02-02-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    SUMProduct with certain text string as a criteria

    Hi,

    I have trying to do a sumproduct formula but to exclude certain cells that have certain text in them,

    my example is as follows


    Buy/Sell Volume Price Reference

    Buy 100 50 MM1
    Buy 200 40 MMA1
    Sell 40 50 MM2
    Buy 20 20 MMA2


    So for this i want to work out the value of all buys but exclude a reference that contains "MMA"

    I can do the normal sumproduct for this but not to exclude the reference...

    =SUMPRODUCT((C3:C6*E3:E6)*(A3:A6="Buy")) so that times the volume by the price for all buys, is there anyway to exlcude the ones that contain "MA" in the reference cell?

    Also is there a way to include certain text but also to exclude certain text as well? So if example there were references other then MMA and MM so i would want to include ones with MM but exclude MMA for example?

    Thanks

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,701

    Re: SUMProduct with certain text string as a criteria

    Maybe:

    =SUMPRODUCT((C3:C6*E3:E6)*(A3:A6="Buy")*(F3:F6<>"*MA*"))


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: SUMProduct with certain text string as a criteria

    Here, try this:

    =SUMPRODUCT(--(A3:A10="Buy"), E3:E10, C3:C10, --ISNUMBER(FIND("MA",F3:F10)))

  4. #4
    Registered User
    Join Date
    02-02-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: SUMProduct with certain text string as a criteria

    Thanks very much for your help guys!!

    Zbor, i used your version because unfortunately TMS version used all texts that contained MM -

    Zbor, is there anyway i can include text strings and but then refine it to exclude certain text strings say if text is very similar?

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: SUMProduct with certain text string as a criteria

    We would need more info about this...

    Upload a workbook with several examples so we can find logic of similar

  6. #6
    Registered User
    Join Date
    02-02-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: SUMProduct with certain text string as a criteria

    Thanks Zbor,

    Example of the data attached.

    So for this example i want to total the value (volume x price) of all items that have a date of 01/01/2012, a buy, and has the reference AAA but doesn't have DD in the reference....notice how similar the references are and there are multiple entries that contain AAA and DD, i so i want to include the references AAA but exclude the ones that have DD.

    Incase my upload doesn't work here is the data.

    Buy/Sell Volume Price Date Reference

    Buy 100 50 01/01/2012 AAA123456789DD
    Buy 200 40 01/01/2012 Value of AAA 01-01-2012
    Sell 40 50 01/02/2012 AAA12345678910BCD
    Buy 20 20 01/01/2012 AAA12345612MNE

    Thanks for your help
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-02-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: SUMProduct with certain text string as a criteria

    Forgot to mention that there would be references that wouldn't include AAA in there so a simple exclude "DD" wouldn't help, it almost would have to include AAA but then exclude ones that have DD in there....does that make sense?

    So if we just excluded "DD" then it would include stuff that doesn't have AAA in there

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: SUMProduct with certain text string as a criteria

    Maybe something like this:
    (You can change criterias in H column)
    Attached Files Attached Files

+ 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