SUMPRODUCT with "Contains" criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good afternoon,
Is there any way in which SumProduct can be used with a "contains" criteria
- for instance, A1:100 contains product codes (for example) AZ1A1100,
ABCZ1A1200, 1A1300 and B1:B100 contains total sales for these products. I
want to extract values from column B for (for example) all products that
CONTAIN the string "1A".
I realise that I could use LEFT, RIGHT or MID as long as the "1A" appears in
the same place in the string, but I want something to cater for the times
when it doesn't.
Thanks in advance
Pete
 
One way

In C1:
=SUMPRODUCT(--ISNUMBER(SEARCH("1A",A1:A100)),B1:B100)

Replace SEARCH with FIND if you need it to be a stricter case sensitive
search. SEARCH is not case sensitive.
 
=SUMPRODUCT(--(NOT(ISERROR(FIND("1A",A1:A100)))),B1:B100)

Regards,
Stefi

„Pete Rooney†ezt írta:
 
Try something like this:

With D1 containing the ProdCode segment to find (eg 1A)

This formula returns the sum of sales for ProdCodes containing that code:
E1: =SUMIF(A1:A100,"*"&D1&"*",B1:B100)

Is that something you can work with?
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)
 
Hi, Stefi,

This works too, as long as you want "1A" only and not "1A" OR "1a".

Thanks very much! :-)

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top