IF - how to avoid cells with no value
Hi,
Glad someone is checking. Anyway with the current example, I think just a
minor modifcation is necessary, add the -1.
=IF(ROW(A1)<=COUNTIF(F$2:F$9,5),INDEX(A$2:A$9,SMAL L(IF(F$2:F$9=5,ROW(F$2:F$9)-1,""),ROW(A1))),"")
Array entered again.
--
If this helps, please click the Yes button.
Cheers,
Shane Devenshire
"T. Valko" wrote:
=IF(ROW(A1)<=COUNTIF(F$2:F$9,5),INDEX(A$2:A$9,SMA LL(IF(F$2:F$9=5,ROW(F$2:F$9),""),ROW(A1))),"")
That formula will miss the first instance that meets the criteria.
Here's the robust version. Let's assume they want the data starting in cell
J2.
Array entered:
=IF(ROWS(J$2:J2)<=COUNTIF(F$2:F$9,5),INDEX(A$2:A$9 ,SMALL(IF(F$2:F$9=5,ROW(F$2:F$9)),ROWS(J$2:J2))-MIN(ROW(F$2:F$9))+1),"")
--
Biff
Microsoft Excel MVP
"Shane Devenshire" wrote in message
...
Hi,
Try the following array formula:
=IF(ROW(A1)<=COUNTIF(F$2:F$9,5),INDEX(A$2:A$9,SMAL L(IF(F$2:F$9=5,ROW(F$2:F$9),""),ROW(A1))),"")
To make it an array enter it by pressing Shift+Ctrl+Enter.
--
If this helps, please click the Yes button.
Cheers,
Shane Devenshire
"Heidi" wrote:
Hello,
I have a monthly report I have to process. There are two values in column
F,
either 5 or 10. If the value of the cell in column F is 5 I want the
information in column A to be displayed, lets say in column J, and if 10
in
column K.
I have used the following formula IF(F2=5,A2,"") which shows me the
information I want in column J. The problem is that I end up with many
cells
with no information in columns J and I would like the cells with values
from
column A to be displayed after each other without empty cells in between.
|