Count cells with “Apple” only in rows that matches the name

kevkev

New Member
Joined
Dec 1, 2019
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I'm trying to create a spreadsheet that counts the number of a particular occurrence on a row only when it matches the name.

Cover Sheet
Col ACol B
Row 1BOB=SUMPRODUCT((General!$A:$A=Cover!A1)*((General!$B:$FZ="Apple")))
Row 2JANE
Row 3JOE
Row 4JOHN

General Sheet
Col ACol BCol C...Col FZ
Row 1JANEAppleOrangeApple
Row 2BOBOrangeAppleOrange
Row 3JOHNAppleAppleApple
Row 4JOEOrangeAppleApple

So far I have this formula =SUMPRODUCT((General!$A:$A=Cover!A1)*((General!$B:$FZ="Apple"))) which works well for small data but it gives the "Excel ran out of resources while attempting to calculate one or more formulas. As a result, these formulas can not be evaluated." when applied to big data (200 rows and 160 columns. File size 97kb). The result of this formula is '1', which is what's expected. I've tried to convert "CountIf" but I can't get it to give the expected results. Help please!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Never you whole columns in an array formula, you should always limit them to the data, or a few rows extra.
Try
=SUMPRODUCT((General!$A1:$A500=Cover!A1)*((General!$B1:$FZ500="Apple")))
 
Upvote 0
Thanks Fluff. Reducing the number of rows worked like magic. It actually skipped my mind cos when I used the whole columns and rows on CountIf, it didn't throw the "ran out of resources" error, just the formula I tried using was giving the wrong result. Can this formula be converted to a CountIf??
 
Upvote 0
Can this formula be converted to a CountIf??
You would need to use Countifs rather than Countif, but not sure it could be done. Sumproduct is probably the better option.
 
Upvote 0
Oh! Okay. I've tried both CountIf and CountIfs but I couldn't get it to work. I'll do with this SumProduct solution. Thanks again for your help!
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,213,496
Messages
6,113,995
Members
448,539
Latest member
alex78

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