Combining SUMPRODUCT and COUNTIF

jme_4477

New Member
Joined
Mar 24, 2016
Messages
43
I'm trying to combine these two formulas:

=SUMPRODUCT((LEN(AS2:AS212)-LEN(SUBSTITUTE(AS2:AS212,"Yes","")))/LEN("Yes"))
=countif(b2:b212="*vermilion*")

Basically, the first formula counts the number of "Yes" in one column, but I need it to only count the "Yes" if another column has "vermilion" in it.

Here's what part of my spreadsheet:

Column B
Column AS
Vermilion High School
Yes, Yes,
Memorial
Yes, No, Yes
South Western
Yes, Yes, Yes, Yes, No

<tbody>
</tbody>


Does anyone know how to do this? I've been working on this for 8 hours!!!

 
Oh, I think we are getting closer. Thank you again for your patience. The name of the sheet with the data is called Sheet2. She on a new sheet, I have typed in this formula:

=SUM(IF(Sheet2!$B$2:$B$212=$B2,(LEN(Sheet2!$AS$2:$AS$212)-LEN(SUBSTITUTE(UPPER(Sheet2!$AS$2:$AS$212),"*Yes*","")))/LEN("*Yes*")))

I don't get any errors, but unfortunately, it doesn't give me the total either. Any ideas?

Now it's my turn to get impatient. Why do you modify Yes to *Yes*"?
 
Last edited:
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I tried it without that as well, but it didnt' work:


=SUM(IF(Sheet2!$B$2:$B$212=$B2,(LEN(Sheet2!$AS$2:$AS$212)-LEN(SUBSTITUTE(UPPER(Sheet2!$AS$2:$AS$212),"Yes","")))/LEN("Yes")))
 
Upvote 0
I think I might know part of the problem. This formula doesn't take "vermilion" from column B. I'm trying to count all of the "Yes" in AS if "vermilion" appears in B.
 
Upvote 0
The count always comes up as 0.

Not here. By the way, I have the criteria in column A of TOTALS. You appear thus to change A2 to B2 in the formula!

See the workbook https://dl.dropboxusercontent.com/u...nditional in-string yes occurrence count.xlsx that implements the formula, which must be confirmed with control+shift+enter:

=SUM(IF(Sheet2!$B$2:$B$14=$A2,(LEN(Sheet2!$AS$2:$AS$14)-LEN(SUBSTITUTE(UPPER(Sheet2!$AS$2:$AS$14),"YES","")))/LEN("yes")))

which adjusted to column B and AS of Sheet2.
 
Upvote 0
IT WORKED!!!!! THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU!!!

One last question if I may though....I need to expand the section on Sheet2, to look for "vermilion" from B2 to B212. Then it will need to count the "Yes" from AS2 to AS212. Here's the formula that worked, but I'm not sure how to expand the section:

=SUM(IF(Sheet2!$B$2:$B$14=$A2,(LEN(Sheet2!$AS$2:$AS$14)-LEN(SUBSTITUTE(UPPER(Sheet2!$AS$2:$AS$14),"YES","")))/LEN("yes")))
 
Upvote 0
I tried this to expand the section, but it didn't work????

=SUM(IF(Sheet2!$B$2:$B$212=$A2,(LEN(Sheet2!$AS$2:$AS$212)-LEN(SUBSTITUTE(UPPER(Sheet2!$AS$2:$AS$212),"YES","")))/LEN("yes")))
 
Upvote 0
IT WORKED!!!!! THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU!!!

One last question if I may though....I need to expand the section on Sheet2, to look for "vermilion" from B2 to B212. Then it will need to count the "Yes" from AS2 to AS212. Here's the formula that worked, but I'm not sure how to expand the section:

=SUM(IF(Sheet2!$B$2:$B$14=$A2,(LEN(Sheet2!$AS$2:$AS$14)-LEN(SUBSTITUTE(UPPER(Sheet2!$AS$2:$AS$14),"YES","")))/LEN("yes")))

I tried this to expand the section, but it didn't work????

=SUM(IF(Sheet2!$B$2:$B$212=$A2,(LEN(Sheet2!$AS$2:$AS$212)-LEN(SUBSTITUTE(UPPER(Sheet2!$AS$2:$AS$212),"YES","")))/LEN("yes")))

Why don't you wait for an answer before making another post? That asked:

You need to reconfirm the formula with control+shift+enter after you modify it.
 
Upvote 0

Forum statistics

Threads
1,216,085
Messages
6,128,732
Members
449,465
Latest member
TAKLAM

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