Hi,
I want to count all dates in column B that are within one year back or date in the future. The below formula works and ignores blank cells, which is exactly what I want, however, the dates are from a vlookup formula, which returns #n/a when it can't find a matching value on the source sheet and if there is even one #n/a in the column that is all that is returned. Is there a way to only exclude #n/a?
In the table below I control counted manually in the right column dates further back than one year (3), dates within the last year (4) and dates in the future (5). I want the formula to return 9 instead of #n/a.
=SUMPRODUCT(SUBTOTAL(3,OFFSET(B6:B23,ROW(B6:B23)-ROW(B6),0,1)),--(B6:B23>TODAY()-365))
[TABLE="width: 218"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD="align: right"]9[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]28/12/14[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD="align: right"]24/12/14[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD="align: right"]15/12/14[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: center"]#N/A[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: center"]#N/A[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]15/11/14[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]14/10/14[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]05/06/14[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD="align: right"]16/04/14[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: center"]#N/A[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]24/03/14[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]15/10/13[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]16/04/13[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: center"]#N/A[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]26/03/13[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]15/10/12[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]
Many thanks,
Ulli
I want to count all dates in column B that are within one year back or date in the future. The below formula works and ignores blank cells, which is exactly what I want, however, the dates are from a vlookup formula, which returns #n/a when it can't find a matching value on the source sheet and if there is even one #n/a in the column that is all that is returned. Is there a way to only exclude #n/a?
In the table below I control counted manually in the right column dates further back than one year (3), dates within the last year (4) and dates in the future (5). I want the formula to return 9 instead of #n/a.
=SUMPRODUCT(SUBTOTAL(3,OFFSET(B6:B23,ROW(B6:B23)-ROW(B6),0,1)),--(B6:B23>TODAY()-365))
[TABLE="width: 218"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD="align: right"]9[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]28/12/14[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD="align: right"]24/12/14[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD="align: right"]15/12/14[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: center"]#N/A[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: center"]#N/A[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]15/11/14[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]14/10/14[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]05/06/14[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD="align: right"]16/04/14[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: center"]#N/A[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]24/03/14[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]15/10/13[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]16/04/13[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: center"]#N/A[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]26/03/13[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]15/10/12[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]
Many thanks,
Ulli