Sumproduct with Partial Text

jlkirk

Active Member
Joined
May 6, 2002
Messages
328
Office Version
  1. 365
Very simple example. Need to total B2:B6 when C2:C6 contains the word "jeff". When I include additional words in any cell with a date month of January in addition to "jeff", the formula ignores the figure in related cell in B2:B6; when I include in the formula "*jeff*", the formula ignores all of the cells in B2:B6 where the adjacent cells in C2:C6 include "jeff"

The formula in B8 is "=SUMPRODUCT(B2:B6,(MONTH(A2:A6)=MONTH($A$1))*(C2:C6="jeff"))"

Any help?
Column A Column B Column C
1/1/2000
1/2/2024​
$100​
jeff
2/5/2024​
$234​
kathy
3/10/2024​
$466​
jon
12/20/2023​
$677​
jeff
1/15/2024​
$899​
Bill Jake Caroline Debby jeff
$100​
Sum B2:B6 when C2:C6 contains the word "jeff" (Should be $999)
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Check this and revert -

Excel Formula:
=SUMIFS(B2:B6,C2:C6,"*jeff*",A2:A6,">="&DATE(2024,1,1),A2:A6,"<="&DATE(2024,1,31))
Edited 👆
 
Last edited:
Upvote 0
There was an error

Check this and revert -

Excel Formula:
=SUMIFS(B2:B6,C2:C6,"*jeff*",A2:A6,">="&DATE(2024,1,1),A2:A6,"<="&DATE(2024,1,31))
 
Upvote 0
Check this and revert -

Excel Formula:
=SUMIFS(B2:B6,C2:C6,"*jeff*",A2:A6,">="&DATE(2024,1,1),A2:A6,"<="&DATE(2024,1,31))
Edited 👆
Yes, it works. Thank you very much.

My questions are (i) why wont the MONTH() function work referencing the MONTH(A1), and, (ii) why wont sumproduct work?
 
Upvote 0
My questions are (i) why wont the MONTH() function work referencing the MONTH(A1), and, (ii) why wont sumproduct work?
Sumproduct function is a clumsy customer to handle, particularly when you need to search within the text. I wonder if it takes wildcards!

Month function I believe works. Honestly I have to recreate whole data to show you it works. Your data is in American format, and I work in India
 
Upvote 0
Sumproduct function is a clumsy customer to handle, particularly when you need to search within the text. I wonder if it takes wildcards!

Month function I believe works. Honestly I have to recreate whole data to show you it works. Your data is in American format, and I work in India
Thank you for your help
 
Upvote 0
Your current formula only looks a the month and ignores the year, is that really you intention ?
SumIfs as suggested by Sanjay will be more efficient but it is going to look at the year as well as the month.
In terms adjusting the SumProduct formula and ignoring the year it would becomes something like this:
Excel Formula:
=SUMPRODUCT(B2:B6, (MONTH(A2:A6)=MONTH($A$1)) * (ISNUMBER(SEARCH("jeff",C2:C6))) )
Your current formula only returns a value where the entire cell = "jeff"

Please update your account profile to show what version of Excel you are using as the solution often varies depending on the version.
 
Upvote 1
Your current formula only looks a the month and ignores the year, is that really you intention ?
SumIfs as suggested by Sanjay will be more efficient but it is going to look at the year as well as the month.
In terms adjusting the SumProduct formula and ignoring the year it would becomes something like this:
Excel Formula:
=SUMPRODUCT(B2:B6, (MONTH(A2:A6)=MONTH($A$1)) * (ISNUMBER(SEARCH("jeff",C2:C6))) )
Your current formula only returns a value where the entire cell = "jeff"

Please update your account profile to show what version of Excel you are using as the solution often varies depending on the version.
Thank you Alex. How would the SumProduct formula be adjusted to account for the year as well?

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,316
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top