How can I filter odd numbers?

  • Thread starter Thread starter Davie
  • Start date Start date
D

Davie

I have a table containing ids. How can i filter the table to show only odd
id numbers?


Alternatively how can I filter the table to show only even numbers?


eg.

1
2
3
4
5

would become

1
3
5

Many thanks
 
You could use another column:

=mod(a2,2)

Then filter to show just the 0's or 1's.
 
Let's say your IDs are in A2:A100
Go to row 2 in next blank column and enter =MOD(A2,2) and copy down column
Dividing N by 2 gives remainder 0 if N is even, 1 otherwise
Hopefully you have labels in row 1; call this column 'Flag'
Now select columns A to the Flag and use Data|AutoFilter; you can select
Flag = 0 or Flag =1

Alternative in blank ("flag") column use =ISEVEN(A2)
Depending on layout, you may find it easier in insert a new A column for the
Flag

best wishes
 
Just to add to Bernard's post.

If you use the =iseven() or =isodd() worksheet function, you'll have to have the
analysis toolpak installed.

Tools|addins
(depending on how you installed excel, you may need the distribution CD, too.)
 
Back
Top