Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / January 2008

Tip: Looking for answers? Try searching our database.

Filtered field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ivan Lötter - 17 Jan 2008 11:39 GMT
Hi,

Is it possible to display filtered fields in a cell on a spreadsheet?

For example I have a column with Numbers. I then filter on the Numbers
and want this specific number to be displayed in a cell which is part
of a title.
CLR - 17 Jan 2008 13:23 GMT
Experiment with Data > Filter > Autofilter > Custom > contains........

Vaya con Dios,
Chuck, CABGx3

> Hi,
>
[quoted text clipped - 3 lines]
> and want this specific number to be displayed in a cell which is part
> of a title.
Max - 17 Jan 2008 14:25 GMT
> Is it possible to display filtered fields in a cell on a spreadsheet?
>
> For example I have a column with Numbers. I then filter on the Numbers
> and want this specific number to be displayed in a cell which is part
> of a title.

Perhaps what you're after is "showfilter"?

If so, try Tom Ogilvy's ShowFilter UDF (below)

To implement the UDF:
Press Alt+F11 to go to VBE
Click Insert > Module
Copy and paste the UDF (below) into the white space on the right
[everything within the dotted lines]

Press Alt+Q to get back to Excel

In Excel, assuming autofilter is applied on cols A to C in row1
To use Tom's UDF, put in say, K1: =showfilter(A1), copy K1 to M1.
K1:M1 will display the autofilter selections made in A1:C1

'---
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

Application.Volatile

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
'---

Signature

Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.