Count values greater than zero in a row that has a defined value in a column

nady94

New Member
Joined
Feb 25, 2021
Messages
2
Office Version
  1. 2010
Platform
  1. Windows
Hi,

I'm trying to count how many weeks a specific Product has been active. The Product has been active if they have a value for that week.

The value in Column B has to match a defined value (i.e. A, B, C, D - the data in cells B12-B15), and then the data from columns C to G have to be greater than zero/not blank. The desired results are in cells C12-C15. Is this possible?

Let me know if there's any additional information I can give that would be helpful.

Thanks!

Book1
ABCDEFGH
1
2ProductWeek 1Week 2Week 3Week 4Week 5
3A234
4B231
5C12142
6D11
7
8
9Desired Result
10
11ProductWeeks Active
12A3
13B3
14C5
15D2
16
Sheet1
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi & welcome to MrExcel.
How about
Excel Formula:
=SUMPRODUCT(($B$3:$B$6=B12)*($C$3:$G$6>0))
 
Upvote 0
Solution
This can be done with a simple COUNTIF. Place this formula in C12 and copy down for C15:
Excel Formula:
=COUNTIF(C3:G3,"<>")
 
Upvote 0
The SUMPRODUCT works perfectly so thank you!

I would've used COUNTIF but the actual values in column B will change as Products are added in different orders and names change. I always prefer to use formulas that have a bit more protection against those sorts of things if possible.

Thanks both!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,120
Members
453,021
Latest member
Justyna P

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