Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Could anyone please help me to write a macro that filters odd & even numbered
IPAddress from a huge list fo data. Thanks & Regards |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this sub (may not be elegant)
your data is in A1 downwards the sub is Public Sub test() Dim myrange As Range Dim cell As Range Dim reminder As Single Dim divisor As Single Set myrange = Range(Range("a1"), Range("a1").End(xlDown)) For Each cell In myrange divisor = cell / 2 divisor = Int(divisor) reminder = cell - divisor * 2 If reminder = 0 Then cell.Offset(0, 1) = cell Else cell.Offset(0, 2) = cell End If Next End Sub banu wrote in message ... Could anyone please help me to write a macro that filters odd & even numbered IPAddress from a huge list fo data. Thanks & Regards |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Baru,
Extract even and odd IP addresses using the Advanced filter with conditions like: :=MOD(RIGHT(A2,1),2)=0 (Even) =MOD(RIGHT(A2,1),2)=1 (Odd) If you are not familiar with the advanced filter feature, see Debra Dalgleish's tutorial at: http://www.contextures.com/xladvfilter01.html --- Regards, Norman "banu" wrote in message ... Could anyone please help me to write a macro that filters odd & even numbered IPAddress from a huge list fo data. Thanks & Regards |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Banu,
conditions like: should read: Criteria like: --- Regards, Norman "Norman Jones" wrote in message ... Hi Baru, Extract even and odd IP addresses using the Advanced filter with conditions like: :=MOD(RIGHT(A2,1),2)=0 (Even) =MOD(RIGHT(A2,1),2)=1 (Odd) If you are not familiar with the advanced filter feature, see Debra Dalgleish's tutorial at: http://www.contextures.com/xladvfilter01.html --- Regards, Norman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Write Macro to Fix Data Alignment (Data dump from Crystal to Excel | Excel Discussion (Misc queries) | |||
create numbered sortable numbered list in excel | Excel Discussion (Misc queries) | |||
write a macro to input data | Excel Discussion (Misc queries) | |||
write macro to input data | New Users to Excel | |||
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? | Excel Worksheet Functions |