#1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default a filter question

I am using the autofilter and cannot figure out a way to do this...
In Column A4:A500, I have 400+ rows with 3 distinct names in the
column; "A","B","C"...
When I filter this column by "A" I would like cell A2 to tell me that
name; "A". If by "B" then "B" etc... If it is not filtered then tell me
"All".

I then will use this name on another sheet & cell in the workbook.


Any help is appreciated!

Hans

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default a filter question

From Tom Ogilvy:

http://j-walk.com/ss/excel/usertips/tip044.htm

to get it to refresh:

=FilterCriteria(B5)&left(Subtotal(9,B5:B200),0)


this is one I wrote back in 2000

Here is a user defined function that will display the criteria in a cell:

Public Function ShowFilter(rng As Range)
Dim filt As Filter
Dim sCrit1 As String
Dim sCrit2 As String
Dim sop As String
Dim lngOp As Long
Dim lngOff As Long
Dim frng As Range
Dim sh As Worksheet
Set sh = rng.Parent
If sh.FilterMode = False Then
ShowFilter = "No Active Filter"
Exit Function
End If
Set frng = sh.AutoFilter.Range

If Intersect(rng.EntireColumn, frng) Is Nothing Then
ShowFilter = CVErr(xlErrRef)
Else
lngOff = rng.Column - frng.Columns(1).Column + 1
If Not sh.AutoFilter.Filters(lngOff).On Then
ShowFilter = "No Conditions"
Else
Set filt = sh.AutoFilter.Filters(lngOff)
On Error Resume Next
sCrit1 = filt.Criteria1
sCrit2 = filt.Criteria2
lngOp = filt.Operator
If lngOp = xlAnd Then
sop = " And "
ElseIf lngOp = xlOr Then
sop = " or "
Else
sop = ""
End If
ShowFilter = sCrit1 & sop & sCrit2
End If
End If
End Function

=ShowFilter(B5)&left(Subtotal(9,B5:B200),0)

would show the filter for column 2

I usually put these functions in cells above the filter


" wrote:

I am using the autofilter and cannot figure out a way to do this...
In Column A4:A500, I have 400+ rows with 3 distinct names in the
column; "A","B","C"...
When I filter this column by "A" I would like cell A2 to tell me that
name; "A". If by "B" then "B" etc... If it is not filtered then tell me
"All".

I then will use this name on another sheet & cell in the workbook.

Any help is appreciated!

Hans


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default a filter question

Dave,


You are the man...both work absolutley WONDERFUL!

Thanks alots!


Hans

  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default a filter question

Tom's the man!

(I just copied|pasted--same as what you did <vbg!)

" wrote:

Dave,

You are the man...both work absolutley WONDERFUL!

Thanks alots!

Hans


--

Dave Peterson
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
Custom Filter Rob Excel Discussion (Misc queries) 18 April 5th 06 03:49 PM
Resetting the Filter Function .. Monk Excel Discussion (Misc queries) 3 February 13th 06 12:36 PM
Very easy question about filter!!! Wilmarjr Excel Discussion (Misc queries) 2 June 27th 05 06:29 PM
filter question Nigel Excel Discussion (Misc queries) 2 May 6th 05 12:59 AM
Auto Filter Limit Question Minitman Excel Discussion (Misc queries) 4 April 13th 05 06:35 AM


All times are GMT +1. The time now is 07:57 AM.

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

About Us

"It's about Microsoft Excel"