Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
RBG RBG is offline
external usenet poster
 
Posts: 9
Default Creating Formulas from Filtered Data

I am trying to create a formula, say in cell B1 that would return the same
info that is returned from my filter. For example if i filter my data on
colors and I return a 'red' result, I would like cell B2 to read 'Colors -
Red'
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Creating Formulas from Filtered Data

See this:

http://tinyurl.com/2885hu

--
Biff
Microsoft Excel MVP


"RBG" wrote in message
...
I am trying to create a formula, say in cell B1 that would return the same
info that is returned from my filter. For example if i filter my data on
colors and I return a 'red' result, I would like cell B2 to read 'Colors -
Red'



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Creating Formulas from Filtered Data

Courtesy of Tom Ogilvy

You use it like so

=L1&":"&showfilter(L1)&CHAR(SUBTOTAL(9,L2)*0+32)

The CHAR(SUBTOTAL bit is just to force a recalc if the criteria are changed

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



--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"RBG" wrote in message
...
I am trying to create a formula, say in cell B1 that would return the same
info that is returned from my filter. For example if i filter my data on
colors and I return a 'red' result, I would like cell B2 to read 'Colors -
Red'



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
Applying formulas to filtered data Keith Excel Discussion (Misc queries) 4 August 2nd 07 05:02 PM
Creating a numbered list on a filtered worksheet Louise Excel Worksheet Functions 12 May 3rd 07 02:40 AM
Formulas, for filtered worksheet Paul S Excel Discussion (Misc queries) 0 March 1st 07 05:50 PM
creating a filtered list ASU Excel Discussion (Misc queries) 1 September 14th 06 10:59 AM
Help to sort out filtered data from the data contained in another sheet of the same workbook No News Excel Worksheet Functions 1 July 28th 06 04:04 PM


All times are GMT +1. The time now is 09:07 PM.

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"