Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
shabb090177
 
Posts: n/a
Default macro to filter out data

I have an xls in which I need to FILTER OUT data

worksheet name: Format
columns name: a) Incentive Name
b) Level
criteria: a) Incentive Name = 'S' or 'N'
b) Level '10'

I have very little experience in Excel previously, more so in macro/VBA
programming. Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Marcelo
 
Posts: n/a
Default macro to filter out data

Hi,

click on the menu DATA | AUTO FILTER

Excel will create an arrow on the top of you column for the column A click
on the arrow select custom put igual S or N (you have two options) click OK

click on the column B arrow select Custom Higher than 10

HTH
Regards from Brazil
Marcelo

"shabb090177" escreveu:

I have an xls in which I need to FILTER OUT data

worksheet name: Format
columns name: a) Incentive Name
b) Level
criteria: a) Incentive Name = 'S' or 'N'
b) Level '10'

I have very little experience in Excel previously, more so in macro/VBA
programming. Thanks in advance.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
shabb090177
 
Posts: n/a
Default macro to filter out data

Hi Marcelo. Thnx in advance. I need to have this in macro. Any sample
of codes?

Marcelo wrote:
Hi,

click on the menu DATA | AUTO FILTER

Excel will create an arrow on the top of you column for the column A click
on the arrow select custom put igual S or N (you have two options) click OK

click on the column B arrow select Custom Higher than 10

HTH
Regards from Brazil
Marcelo


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JonR
 
Posts: n/a
Default macro to filter out data

Sub Filter()


ActiveWindow.ScrollRow = 1
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=S*", Operator:=xlOr, _
Criteria2:="=N*"
Selection.AutoFilter Field:=2, Criteria1:="10"

End Sub


"shabb090177" wrote:

Hi Marcelo. Thnx in advance. I need to have this in macro. Any sample
of codes?

Marcelo wrote:
Hi,

click on the menu DATA | AUTO FILTER

Excel will create an arrow on the top of you column for the column A click
on the arrow select custom put igual S or N (you have two options) click OK

click on the column B arrow select Custom Higher than 10

HTH
Regards from Brazil
Marcelo



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
shabb090177
 
Posts: n/a
Default macro to filter out data

Thanks Jon,

But this allows me to select only data that met the criteria. How do I
inverse/reverse the selection. I need to filter out these data.

My requirement, get data in Field A which is not S or N; and above 10
in Field B

(Field A != 'S' or Field A != 'N') and Field B = 10

JonR wrote:
Sub Filter()


ActiveWindow.ScrollRow = 1
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=S*", Operator:=xlOr, _
Criteria2:="=N*"
Selection.AutoFilter Field:=2, Criteria1:="10"

End Sub




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JonR
 
Posts: n/a
Default macro to filter out data

Sorry Shabb,

I must have misread the original criteria. This should do the trick. The
criteria are between the quotes. You can adjust them as appropriate.


Sub Filter()

ActiveWindow.ScrollRow = 1
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<S*", Operator:=xlAnd, _
Criteria2:="<N*"
Selection.AutoFilter Field:=2, Criteria1:="=10"

End Sub

"shabb090177" wrote:

Thanks Jon,

But this allows me to select only data that met the criteria. How do I
inverse/reverse the selection. I need to filter out these data.

My requirement, get data in Field A which is not S or N; and above 10
in Field B

(Field A != 'S' or Field A != 'N') and Field B = 10

JonR wrote:
Sub Filter()


ActiveWindow.ScrollRow = 1
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=S*", Operator:=xlOr, _
Criteria2:="=N*"
Selection.AutoFilter Field:=2, Criteria1:="10"

End Sub



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
broro183
 
Posts: n/a
Default macro to filter out data


hi Shabb,

"I have very little experience in Excel previously, more so in
macro/VBA
programming."

The best way to get an understanding of how VBA can be used in excel is
to record a macro as you complete the required action manually & then
modify the resulting code. To record a macro Tools - Macro - Record new
macro ie [alt + t + m + r], follow the prompts, complete your actions,
and stop recording (either the stop button on popup toolbar or [alt + t
+ m + r] again).

fyi, this would record almost an identical macro to the solution given
below.

hth
Rob Brockett
NZ
Always learning & the best way to learn is to experience...


--
broro183
------------------------------------------------------------------------
broro183's Profile: http://www.excelforum.com/member.php...o&userid=30068
View this thread: http://www.excelforum.com/showthread...hreadid=555123

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
shabb090177
 
Posts: n/a
Default macro to filter out data

Hi Rob,

Thing is I don't quite understand how the filter works in the first
place. Tried to understand and fit it into my requirement yet could not
see it.

Jon,

Thanks a lot. I still got to twitch it to suit what I am required to
produce but this is beautiful. Thank you again.

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JonR
 
Posts: n/a
Default macro to filter out data

Glad to help. Let us know if there's something you can't figure out

JonR

"shabb090177" wrote:

Hi Rob,

Thing is I don't quite understand how the filter works in the first
place. Tried to understand and fit it into my requirement yet could not
see it.

Jon,

Thanks a lot. I still got to twitch it to suit what I am required to
produce but this is beautiful. Thank you again.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro that filter data Conditional Formatting Excel Worksheet Functions 1 January 11th 06 06:16 PM
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM
import data using macro chris_rip Excel Discussion (Misc queries) 0 July 18th 05 08:32 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
Daily Macro to Download Data, Order and paste in order Iarla Excel Worksheet Functions 1 November 17th 04 01:59 PM


All times are GMT +1. The time now is 10:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"