View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Count in a variable range

Is this what you mean?

=COUNTIF(INDEX(8:8,MATCH(DAY(E2),A7:AP7,0)):IV8,"W ")

I have to admit to being a tad confused as if you put the day numbers in A7
on, the furthest you get to is AE7, so how can there be W in AM8 etc. if the
Ws align with the day numbers.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Ron@Buy" wrote in message
...
Thank you Bob, works OK if a "W" is entered in cells AM8, AN8, AO8
onwards.
But AM8 was used as an example to represent the first cell of the variable
range. Tried changing AM8 to L8 (1 is in row 7) but doesn't work! The
ADDRESS
function demonstrates that when the date in E2 changes the "AM8" cell
reference also changes. The purpose of the variable cell reference is to
ignore any "W"s that appear in the row (8) to the left of the variable
cell
reference. (e.g. if date in E2 is 10/09/2007 and "W" appears in a cell
(row
8) below any number (row 7) between 1 and 9 - COUNTIF ignores it.
Would appreciate if you could spare time to revisit.
Thanks

"Bob Phillips" wrote:

Try

=COUNTIF(OFFSET(AM8,0,0,1,MATCH(DAY(E2),A7:AP7,0)) ,"W")

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Ron@Buy" wrote in message
...
I am trying to count the number of "W"s entered into a row (e.g. row 8).
Row 7 has the days of each month (i.e. 1 thro' 28, 30, 31 as
appropriate)
each number is entered in two merged cells (identifies a.m & p.m. in
the
rows
below)
Cell E2 contains a date
Using a formula, I need to count the "W"s in a range between a (first
cell)
variable column row 8 and GW8 (formula will be copied down)
The variable first cell is dependent upon the date (E2) thus using
=ADDRESS(8,MATCH(DAY(E2),A7:AP7,0),4) will result in the correct cell
for
the beginning of the range.
=COUNTIF(AM8:GW8,"W") works perfectly, however when the two are
incorporated
thus
=COUNTIF(ADDRESS(8,MATCH(DAY(E2),A7:AP7,0),4):GW8, "W") I am told "The
formula I typed contains an error".
Any ideas what am I doing wrong?