Counting cells

R

Raymond Wood

I have a number of dates in the range $A$2:$AE$2.

These all begin from a specified date, which is entered in
cell A1.

So if cell A1 has 1-March-2003 input, the range $A$2:$AE$2
will show:

1-March-2003, 2-March-2003, 3-March-2003, 6-March-2003, 7-
March-2003, 8-March-2003, etc.

Note that some days are missed out as they represent
weekend days, and I do not need data from these.

The range $A$2:$AE$2 has 31 cells in it, and some of these
will represent days during April.

What I want to do is count the number of cells within this
range that are during March. How do I do this??
 
P

Paul

Raymond Wood said:
I have a number of dates in the range $A$2:$AE$2.

These all begin from a specified date, which is entered in
cell A1.

So if cell A1 has 1-March-2003 input, the range $A$2:$AE$2
will show:

1-March-2003, 2-March-2003, 3-March-2003, 6-March-2003, 7-
March-2003, 8-March-2003, etc.

Note that some days are missed out as they represent
weekend days, and I do not need data from these.

The range $A$2:$AE$2 has 31 cells in it, and some of these
will represent days during April.

What I want to do is count the number of cells within this
range that are during March. How do I do this??

One way:
=SUMPRODUCT(--(MONTH($A$2:$AE$2)=3))
 
R

Raymond Wood

Thanks, THat works!!

What does the -- at the beginning of the SUMPRODUCT
formula do??
 
P

Paul

SUMPRODUCT expects numeric parameters. (MONTH($A$2:$AE$2)=3) is boolean
(i.e. TRUE or FALSE). The two minus signs simply convert TRUE to 1 and FALSE
to 0. You could do the same thing with
=SUMPRODUCT((MONTH($A$2:$AE$2)=3)*1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top