# using SUMPRODUCT with DATE

##### New Member
I am building inventory report to show how inventory is doing
When I do counts for each day I enter manual data into the excel table i have build
like in first column I have Date of cycle count, next part#, Stock location, physical count, variance value \$
I tally all the numbers on a separate table to be more readable
I am having trouble with SUM product function and date range
I want to count how many variances are in a month,
The tables I use are
DATE of cycle count and Variance
in the month of January I have entered 700 lines and each line has a variance of either \$0 or \$ range in plus (extra stock) and minus (missing stock)
I want to count the variances how many I have done in January , february, march
originally I use this function =SUMPRODUCT(--(LEN(G23:G10000)>0)) and it calculates perfectly the variances but now I have data entry for February, March, and April
and this function counts all how can I make this work for each separate month?
all The dates are entered in A23:A10000 and variances are in G23:G10000

#### jtakw

##### Well-known Member
Hi,

If I understand correctly, the following will do what you want, might need some tweaking if I misunderstood.
Also, the formula you're using to Count Variances can be done simply by a COUNTA function, as shown in L23 and M23.

<b>Excel 2010</b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>G</th><th>H</th><th>I</th><th>J</th><th>K</th><th>L</th><th>M</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">22</td><td style=";">Date</td><td style="text-align: right;;"></td><td style=";">Variance</td><td style="text-align: right;;"></td><td style=";">Month</td><td style=";">Variance Count</td><td style="text-align: right;;"></td><td style=";">Your sumproduct formula</td><td style=";">Count formula</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">23</td><td style="text-align: right;;">2/2/2018</td><td style="text-align: right;;"></td><td style="text-align: right;;">1</td><td style="text-align: right;;"></td><td style="text-align: right;;">Feb-18</td><td style="text-align: right;;">2</td><td style="text-align: right;;"></td><td style="text-align: right;;">8</td><td style="text-align: right;;">8</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">24</td><td style="text-align: right;;">3/5/2018</td><td style="text-align: right;;"></td><td style="text-align: right;;">2</td><td style="text-align: right;;"></td><td style="text-align: right;;">Mar-18</td><td style="text-align: right;;">1</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">25</td><td style="text-align: right;;">2/5/2018</td><td style="text-align: right;;"></td><td style="text-align: right;;">3</td><td style="text-align: right;;"></td><td style="text-align: right;;">Apr-18</td><td style="text-align: right;;">3</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">26</td><td style="text-align: right;;">4/15/2018</td><td style="text-align: right;;"></td><td style="text-align: right;;">4</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">27</td><td style="text-align: right;;">4/7/2018</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">28</td><td style="text-align: right;;">10/11/2018</td><td style="text-align: right;;"></td><td style="text-align: right;;">6</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">29</td><td style="text-align: right;;">4/18/2018</td><td style="text-align: right;;"></td><td style="text-align: right;;">7</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">30</td><td style="text-align: right;;">7/20/2018</td><td style="text-align: right;;"></td><td style="text-align: right;;">8</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">31</td><td style="text-align: right;;">4/1/2018</td><td style="text-align: right;;"></td><td style="text-align: right;;">9</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr></tbody></table><p style="width:5.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet18</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">L23</th><td style="text-align:left">=SUMPRODUCT(<font color="Blue">--(<font color="Red">LEN(<font color="Green">G23:G10000</font>)>0</font>)</font>)</td></tr><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">M23</th><td style="text-align:left">=COUNTA(<font color="Blue">G23:G10000</font>)</td></tr><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">J23</th><td style="text-align:left">=SUMPRODUCT(<font color="Blue">(<font color="Red">MONTH(<font color="Green">A23:A10000</font>)=MONTH(<font color="Green">I23</font>)</font>)*(<font color="Red">G23:G10000<>""</font>)</font>)</td></tr></tbody></table></td></tr></table><br />

##### MrExcel MVP
Avoid testing just month, unless the year must be explicitly ignored... So, for correctness:

=SUMPRODUCT(--(\$A\$23:\$A\$31-DAY(\$A\$23:\$A\$31)+1=E23),--ISNUMBER(\$C\$23:\$C\$31))

where E23 is a first day date like 2018-02-01 (means the month/year of February 2018).

##### New Member
OK thank you let me try

##### New Member
It worked perfectly thank you

#### jtakw

##### Well-known Member
You're welcome, welcome to the forum.

1,082,359
Messages
5,364,916
Members
400,815
Latest member
Joaquin Phoenix

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...