View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Copying certain values from one column into another column

In B2:
=IF(A2="","",IF(ISNUMBER(SEARCH(".",A2)),"",ROW()) )
Leave B1 blank


Col B is the criteria col, which flags col A where col A does not contain
decimals with arb row numbers (ie where the search for the "." is positive,
to return blanks: "", if not return the arb row number). These arb row
numbers will be read by SMALL in col C. The refrain to leave B1 blank is to
ensure that the arb row numbers returned in B2 down will not be "disrupted" &
prevent a mess-up in col C.

In C2:
=IF(ROWS($1:1)COUNT(B:B),"",INDEX(A:A,SMALL(B:B,R OWS($1:1))))


SMALL(B:B,ROWS($1:1)) uses an incrementer part: ROWS($1:1) to return the
smallest number in col B in the top cell, C2. When copied down, the ROWS(...)
part of it will return the series: 1,2,3,4,... hence SMALL(B:B,ROWS(...))
will return the 2nd smallest number in C3, the 3rd smallest in C4, and so on.
These numeric returns from SMALL(B:B,ROWS(...)) are then passed to INDEX(A:A
to yield the required results from col A.

The front IF part: IF(ROWS($1:1)COUNT(B:B),"",
serves to "suppress" the ugly #NUM errors which would appear otherwise, once
all the returns are exhausted in the copy down.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Eddie Morris" wrote:
Hi Max,

Thank you for your quick response, that was a useful tip although I am not
quite sure I understand the code.

Could you explain what you have done? :-)

Thanks Eddie