Hi ,
To add to what has already been posted , your formula in cell B6 in the tab named Monthwise Trng View is :
=IF(COUNTIF(Calendar!C4:C100,">0")<=ROWS($A$6:A6),"",INDEX(Calendar!$A$1:$A$100,SMALL(IF(Calendar!$C$4:$C$100>0,ROW(Calendar!$A$4:$A$100)),ROW(A1))))
What this is supposed to do is :
1. Get the number of entries in column C , in the range C4:C100 , that are greater than zero. Suppose this is 31.
2. If the number of rows , starting from 1 on row 6 , exceeds the number derived in 1 above , say 31 , then insert blanks , otherwise insert the value returned by the formula :
INDEX(Calendar!$A$1:$A$100,SMALL(IF(Calendar!$C$4:$C$100>0,ROW(Calendar!$A$4:$A$100)),ROW(A1)))
What the above formula does is it returns the first row which has a positive non-zero value in column C ; thereafter , in succession , it will return the second row , the third row and so on ; when there are no more rows which have a positive non-zero value in column C , which will happen when we come to the 32nd row , the SMALL function will return the #NUM! error value , which is what is being displayed.
All rows beyond the 31st row will return this error value.
It is to ensure that this calculation which will return the #NUM! error value does not happen , that the IF function has been used , so that for all rows after the 31st row , the IF function will insert a blank.
However , this has not worked because the initial test within the IF function , which uses the COUNTIF function , has not used absolute referencing as follows :
COUNTIF(Calendar!C$4:C$100,">0")
where the $ signs highlighted in RED , signify absolute addressing for the row references.
In the absence of absolute referencing , when the formula is copied down , the above portion keeps changing as shown below :
COUNTIF(Calendar!C4:C100,">0")
COUNTIF(Calendar!C5:C101,">0")
COUNTIF(Calendar!C6:C102,">0")
COUNTIF(Calendar!C7:C103,">0")
This is bound to return the wrong values , depending on what is present in cells C101 , C102 , C103 ,....
which is why only 3 cells display the #NUM! error values , while the ones beyond display blanks.
Inserting the $ sign appropriately will ensure that only blanks are displayed from row 32 downwards.
Narayan