HomeGoogle DocsSpreadsheetHow to Do a Case Sensitive Sumproduct in Google Sheets

How to Do a Case Sensitive Sumproduct in Google Sheets

Published on

Case Sensitive Sumproduct is possible in Google Sheets. But not in the way you do it in Excel. I’ll come to that.

I’ve recently written a series of posts related to Case Sensitive Formulas in Google Sheets.

You can use the search field on the top navigation bar with the keyword “Case Sensitive” to fetch links to those posts.

Case Sensitive Sumproduct in Google Sheets

As you know, SUMPRODUCT in Google Sheets is a case In-sensitive function. This function treats “A” and “a” as identical.

So how to make Sumproduct Case Sensitive in Google Sheets?

Here is an example.

Sample Data:

Sample Data for Case Sensitive Sumproduct

You may type the above sample data into a plain Google Doc Spreadsheet, keeping the range I have provided.

Now, let’s find the total amount in column G for the Product “SH101A” in column A.

Note:- Please note that the word “Product” above is the field label in cell A1, not the Product in the Sumproduct.

You can see similar products in column A, i.e., “SH101A” and “SH101a”, but both are different w.r.t. case sensitivity.

When you use a standard Sumproduct formula, or you can say case insensitive formula as below, it would return the result 1350.00 as it treats the cells A2, A3, and A6 identical.

Case Insensitive Sumproduct Formula

=SUMPRODUCT((A2:A6="SH101A")*(G2:G6))

Case Sensitive Sumproduct Formula

Now see the Case Sensitive Sumproduct Formula in Google Sheets below, which would return 900.00.

The reason is that it finds the match only in cells A2 and A6.

The array or range A2:A6 in the above case insensitive formula is different in the case-sensitive formula below.

Another change is in the criterion. The text criteria in the first formula, “SH101A”, changed in the second formula to # 1.

=sumproduct((ArrayFormula(- -isnumber(find(A2:A6,"SH101A")))=1)*G2:G6)

In the second formula, I’ve used ArrayFormula, ISNUMBER, and FIND functions to create a virtual array instead of A2:A6. Here is that step by step instructions.

Formula Explanation

The FIND function may not work with an array as below.

=find(A2:A6,"SH101A")

You may want to use the ArrayFormula function with it.

=ArrayFormula(find(A2:A6,"SH101A"))

This formula searches the array A2:A6 for the key “SH101A” and returns # 1 if it finds the exact match. Else it would return #VALUE!.

Array Formula, Find Combo for Sumproduct

When you wrap the above ArrayFormula + Find function combined with an ISNUMBER formula, it would modify the output as below.

=ArrayFormula(--isnumber(find(A2:A6,"SH101A")))

Result:

Array Formula, ISNUMBER, Find Combo for Sumproduct

This virtual array replaces A2:A6.

Here the numeric value 1 represents the exact match of criteria SH101A, and 0 is a mismatch.

As a result, for this new range, we can use the criteria as numeric value 1, not the text criteria “SH101A”.

In this way, you can convert a Case Insensitive Sumproduct formula to Case Sensitive in Google Sheets.

But in Excel, there is a different approach with the Exact function. Enjoy!

Conclusion

I’ve only given one option above. You can also use regular expressions in this case.

For example, the following formula will return 900, similar to the above formula result.

=ArrayFormula(sumproduct(regexmatch(A2:A6,"^SH101A$")*G2:G6))

Here, the REGEXMATCH (exactly) matches the condition SH101A and returns TRUE (1) or FALSE (0).

So, you can use this formula also for Case Sensitive Sumproduct in Google Sheets.

Advanced Google Docs Sumproduct Function Formulas and Tutorials:

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

Excel Word Count: Beyond SUBSTITUTE

You might want to count the number of words in a cell in Excel...

More like this

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.