Hi,
The problem here is not the answers, it is the question. You should tell us
1. whether you are counting the number of items in the Qty or Value field 2.
Maybe you really want to sum the Qty or Value field?, 3. If there is data in
all the cells of the column you want to count (Qty or Value) then counting
the number of items between two date means you can ignore the Qty or Value -
so is there data in all the cells of the column you want to count?
================
Suppose the dates are in A2:A400 and the Qty in B2:B400 and the Values in
C2:C400, and suppose you want the count the number of items in the Qty field
that fall between 1/1/2009 and 1/2/2009 (Day/Month/Year). Then
=SUMPRODUCT(--(A2:A400>=--"1/1/09"),--(A2:A400<=--"1/2/09"),--(B2:B400<>""))
Now if all the cells in column B contain entries when there are entries in
column A, then you can simplify this formula down to
=SUMPRODUCT(--(A2:A400>=--"1/1/09"),--(A2:A400<=--"1/2/09"))
If you are really trying to sum the Qty field then the formula would be
=SUMPRODUCT(--(A2:A400>=--"1/1/09"),--(A2:A400<=--"1/2/09"),B2:B400)
Now you can simplify all these approach by entering the start data and the
end date in cell of the spreadsheet for example D1 and D2
Then the three formulas become:
=SUMPRODUCT(--(A2:A400>=D1),--(A2:A400<=D2),--(B2:B400<>""))
=SUMPRODUCT(--(A2:A400>=D1),--(A2:A400<=D2))
=SUMPRODUCT(--(A2:A400>=D1),--(A2:A400<=D2),B2:B400)
In 2007 you can use the above or
=COUNTIFS(A2:A400,">=1/1/09",A2:A400,"<=1/2/09",B2:B400,"<>")
=COUNTIFS(A2:A400,">=1/1/09",A2:A400,"<=1/2/09")
=SUMIFS(B2:B400,A2:A400,">=1/1/09",A2:A400,"<=1/2/09")
or using the cell references for the start and end dates
=COUNTIFS(A2:A400,">="&D1,A2:A400,"<="&D2,B2:B400,"<>")
=COUNTIFS(A2:A400,">="&D1,A2:A400,"<="&D2)
=SUMIFS(B2:B400,A2:A400,">="&D1,A2:A400,"<="&D2)
If you are trying to work with the Value column change the above references
to C2:C400 or whatever your range is.