Count a value in a cell (within a specified range) every nth cell along the row

nature98

New Member
Joined
Feb 3, 2024
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I am stumped. I tried researching the forums and google to get a formula that work. I am trying to count a value in a cell (with a range of 3 or higher) every 4th cell along the row. I do not want the formula to count text or blank cells. My cell range across the row is G28:HK28. The cell I want to count starts at G28. Hope you gurus can help. I know how to use the CountIF functions but when I tried the sumproduct and mod functions, I just cannot get it to add up correctly.

Help me Okbi Wan Kenobi...you are my only hope.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
If G28 is the 1st cell to consider, what is the next?...I'm not clear on whether every 4th cell means J28 or K28.
 
Upvote 0
Thanks...and when you say:
I do not want the formula to count text or blank cells.
...could we say that you only want to count the cells if the contents are numbers...including 0? There is a nuance in Excel regarding the definition of a "blank" cell, so I'd like to get some clarity on this point.
 
Upvote 0
Have a look to see if this delivers expected results:
Book1
FGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAO
2834214526719467454568211146a-1-9
29count5
Sheet2
Cell Formulas
RangeFormula
G29G29=LET(a,FILTER(G28:HK28,MOD(SEQUENCE(,COLUMNS(G28:HK28),0),3)=0),SUM((a>=3)*ISNUMBER(a)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G28:HK28Expression=MOD(COLUMNS($G$28:G$28)-1,3)=0textNO
 
Upvote 0
Thanks...and when you say:

...could we say that you only want to count the cells if the contents are numbers...including 0? There is a nuance in Excel regarding the definition of a "blank" cell, so I'd like to get some clarity on this point.
There is no zero in the cell. It will be blank. I have a pick list in the cells I wish to count. When a value is not picked, it is blank. The range of the pick list in a cell is "X, 1, 2 , 3 ,4".
 
Upvote 0
Have a look to see if this delivers expected results:
Book1
FGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAO
2834214526719467454568211146a-1-9
29count5
Sheet2
Cell Formulas
RangeFormula
G29G29=LET(a,FILTER(G28:HK28,MOD(SEQUENCE(,COLUMNS(G28:HK28),0),3)=0),SUM((a>=3)*ISNUMBER(a)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G28:HK28Expression=MOD(COLUMNS($G$28:G$28)-1,3)=0textNO
Brilliant! Your formula worked! Thank you so much!
 
Upvote 0
Brilliant! Your formula worked! Thank you so much!
One last question. If I wanted to count the letter "X" in my range of values within the cell to count what wopuld the formula look like?
 
Upvote 0
I think the earlier solution could be simplified...the a>=3 condition automatically means the value must be a number, so the ISNUMBER part isn't needed. Here's a revision to accommodate "X":
MrExcel_20240203.xlsx
FGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAO
2834214526719467454568221156aX-9
29count7
Sheet2
Cell Formulas
RangeFormula
G29G29=LET(a,FILTER(G28:HK28,MOD(SEQUENCE(,COLUMNS(G28:HK28),0),3)=0),SUM(--(((a="X")+(a>=3))>0)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G28:HK28Expression=MOD(COLUMNS($G$28:G$28)-1,3)=0textNO
 
Upvote 0
Sorry...just occurred to me that text will evaluate as >3, so there is a problem with last post. This should resolve the problem:
MrExcel_20240203.xlsx
FGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAO
2834214526719467454568221156aX-9
29count6
Sheet2
Cell Formulas
RangeFormula
G29G29=LET(a,FILTER(G28:HK28,MOD(SEQUENCE(,COLUMNS(G28:HK28),0),3)=0),SUM(--(((a="X")+ISNUMBER(a)*(a>=3))>0)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G28:HK28Expression=MOD(COLUMNS($G$28:G$28)-1,3)=0textNO
 
Upvote 0

Forum statistics

Threads
1,215,123
Messages
6,123,181
Members
449,090
Latest member
bes000

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