How can I filter odd numbers?

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
 
D

Dave Peterson

You could use another column:

=mod(a2,2)

Then filter to show just the 0's or 1's.
 
B

Bernard Liengme

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
 
D

Dave Peterson

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

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