IF - how to avoid cells with no value

H

Heidi

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.
 
F

francis

In column J, you want to display the value in column A if column F is 5
and 10 in column K and that you have your formula in both J and K
if there is no 5 or 10 in F, the formula will return a blank as in your
formula
Therefore, not sure what you want to achieve here,
would you post a sample and the result you want?
--
Hope this is helpful

Pls click the Yes button below if this post provide answer you have asked


Thank You

cheers, francis
 
A

Art

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.
Heidi,
It's not exactly clear by your last statement what you intend for your
end result. Could you post an example ?
 
S

Shane Devenshire

Hi,

Try the following array formula:

=IF(ROW(A1)<=COUNTIF(F$2:F$9,5),INDEX(A$2:A$9,SMALL(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.
 
G

Gord Dibben

Heidi

To get the values into a contiguous range would require VBA as far as I can
tell from your description.

Or you could autofilter each column J and K in turn for non-blanks then copy
to another range.


Gord Dibben MS Excel MVP
 
T

T. Valko

=IF(ROW(A1)<=COUNTIF(F$2:F$9,5),INDEX(A$2:A$9,SMALL(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),"")
 
S

Shane Devenshire

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,SMALL(IF(F$2:F$9=5,ROW(F$2:F$9)-1,""),ROW(A1))),"")

Array entered again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top