View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default getting numbers divisible by 4 from random numbers in ascending order

On Tue, 19 Jun 2007 06:49:09 -0000, ramana wrote:

Hi Everybody,

one more problem, I have random numbers in column A, now in
column B I need the numbers that are divisible by 4 in ascending order
in consequtive rows. could any body help me to solve this.

Thanks and Regards

Ramana


Where rng is a defined name for the values in column A, and does not include
the entire column, then the following **array** formula should do the trick.

To enter an **array** formula, after typing/pasting the formula into the
formula bar, you must hold down <ctrl<shift while hitting <enter. Excel
will place braces {...} around the formula.

=IF((SUM(--(MOD(rng,4)<0))+ROWS($1:1))COUNT(rng),"",
SMALL((MOD(rng,4)=0)*rng,SUM(--(MOD(rng,4)<0))+ROWS($1:1)))

Fill down as far as necessary (until the formula starts returning blanks).

Note that empty cells and zeros will be evaluated as divisible by four and will
be returned by this formula.
--ron