View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Lewis0205NC
 
Posts: n/a
Default How do I count cells that contain one of several specific numb

Thank you very much. The formula did work but I was hoping to understand it
a little better. I'd like to better understand how you formulated especially
the first part of the formula so that for example, I could modify it if I
wanted to examine data in the same row but maybe not every third column. Can
you help or direct me to where I can get more information about forming these
type of formulas. Thanks, again.

"Ron Coderre" wrote:

Well, now....It seems that your first example had the all of the data in the
same column, but what you really wanted was an examination of data in a
single row.

Try this:

=SUMPRODUCT((MOD(COLUMN(H8:AH8),3)=2)*ISNUMBER(MAT CH(H8:AH8,{1,2,3,4,5},0)))

If you change the range, you'll probably need to tweak the MOD function.
Currently, it calculates the remainder of each cell's column number divided
by 3. If that remainder = 2, then the cell's value is tested, otherwise it's
ignored.

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro


"Lewis0205NC" wrote:

It seems a little complicated but I tried it. I got an error. Please let me
know what you think?

=SUMPRODUCT((ROW(H8:AH8)={1,4,7,10,13,16,19,22,25} )*ISNUMBER(MATCH(H8:AH8,{1,2,3,4,5},0)))

"Lewis0205NC" wrote:

I am trying to count the number of cells in a row that contain 1 to 5 but I
cells are not adjacent. I am counting from every 3rd column cells which
contain 1, 2, 3, 4, or 5. I tried using the
=COUNTIF(A1,A4,A7,A10,A13,A16,"1:5") but that obviously didn't work. Any
advise?