ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   string matching (https://www.excelbanter.com/excel-worksheet-functions/183149-string-matching.html)

adimar

string matching
 
Please help me understand why these apparently equivalent constructs behave
differently? I use them as multipliers in SUMPRODUCT.

The formula is something like:
=SUMPRODUCT((Product={"MGC","EMS"})*(Type={"Servic e Issue","Upgrade"}))


This one does not work as expected: (Type={"Service Issue","Upgrade"})

This one does work as expected: ((Type="Service Issue") + (Type ="Upgrade"))

I expect the formula to count records of Type "Service Issue" OR "Upgrade",
that is allow for either.


Thank you,
Marta



Teethless mama

string matching
 
Try like this:

=SUMPRODUCT((ISNUMBER(MATCH(Product,{"MGC","EMS"}, 0)))*(ISNUMBER(MATCH(Type,{"Service Issue","Upgrade"},0))))



"adimar" wrote:

Please help me understand why these apparently equivalent constructs behave
differently? I use them as multipliers in SUMPRODUCT.

The formula is something like:
=SUMPRODUCT((Product={"MGC","EMS"})*(Type={"Servic e Issue","Upgrade"}))


This one does not work as expected: (Type={"Service Issue","Upgrade"})

This one does work as expected: ((Type="Service Issue") + (Type ="Upgrade"))

I expect the formula to count records of Type "Service Issue" OR "Upgrade",
that is allow for either.


Thank you,
Marta



adimar

string matching
 

Yes, the formula you proposed works.

The question still remains: What is wrong with this syntax?
(Type={"Service Issue","Upgrade"})

Why does this one work?
(Product={"MGC","EMS"})

I would prefer this syntax as it is more compact and makes troubleshooting
or review easier.


Thank you.


"Teethless mama" wrote:

Try like this:

=SUMPRODUCT((ISNUMBER(MATCH(Product,{"MGC","EMS"}, 0)))*(ISNUMBER(MATCH(Type,{"Service Issue","Upgrade"},0))))



"adimar" wrote:

Please help me understand why these apparently equivalent constructs behave
differently? I use them as multipliers in SUMPRODUCT.

The formula is something like:
=SUMPRODUCT((Product={"MGC","EMS"})*(Type={"Servic e Issue","Upgrade"}))


This one does not work as expected: (Type={"Service Issue","Upgrade"})

This one does work as expected: ((Type="Service Issue") + (Type ="Upgrade"))

I expect the formula to count records of Type "Service Issue" OR "Upgrade",
that is allow for either.


Thank you,
Marta




All times are GMT +1. The time now is 06:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com