View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
david mcritchie david mcritchie is offline
external usenet poster
 
Posts: 691
Default how to write macro that filters odd & even numbered data ?

I don't know if you have Text or Numbers, the following will work for either:

The follow formula provides True for Even numbers
=TRUNC(RIGHT(A1)/2)*2=RIGHT(A1)+0

The following formula provides True for Odd numbers
= NOT(TRUNC(RIGHT(A1)/2)*2=RIGHT(A1)+0)

You can read about filtering at
http://www.contextures.com/tiptech.html

The easiest way is to use a helper column, put either formula into Column B
then Select Column B (cell B1 active cell), Data, Filter, Auto Filter
on the arrow drop down choose True or choose False

You can copy the cells and paste elsewhere because a filtered list exposes
on those that make it through the filter, or you can print the list. .
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"banu" wrote ...
Could anyone please help me to write a macro that filters odd & even numbered
IPAddress from a huge list fo data.